1# Documentation is built with xmlto, but some of the recipes in here are 2# leftovers from building with Publican (https://fedorahosted.org/publican/) 3# 4# How this build works: 5# * the main target is Wayland, documentation ends up in $(builddir)/Wayland/ 6# * hand-written chapters and CSS files are located in sources. These are 7# copied into $(builddir)/en-US/ 8# * ProtocolSpec.xml is generated from $(top_srcdir)/protocol/wayland.xml, 9# changed into docbook via XSLT and saved in $(builddir)/en-US/ 10# * ProtocolInterfaces.xml, same as above, uses a different XSLT 11# * *API.xml is generated from the doxygen output and saved in 12# $(builddir)/en-US 13# * run xmlto on $(builddir)/en-US, output to $(builddir)/Wayland/en-US 14 15doxydir := $(top_builddir)/doc/doxygen 16html_destdir := $(builddir)/Wayland/en-US/html 17 18publican_sources = \ 19 $(srcdir)/sources/Wayland.ent \ 20 $(srcdir)/sources/Wayland.xml \ 21 $(srcdir)/sources/Book_Info.xml \ 22 $(srcdir)/sources/Author_Group.xml \ 23 $(srcdir)/sources/Foreword.xml \ 24 $(srcdir)/sources/Preface.xml \ 25 $(srcdir)/sources/Revision_History.xml \ 26 $(srcdir)/sources/Protocol.xml \ 27 $(srcdir)/sources/Compositors.xml \ 28 $(srcdir)/sources/images/icon.svg \ 29 $(srcdir)/sources/images/wayland.png \ 30 $(srcdir)/sources/Client.xml \ 31 $(srcdir)/sources/Server.xml 32 33processed_sources := \ 34 $(srcdir)/sources/Architecture.xml \ 35 $(srcdir)/sources/Introduction.xml 36 37css_sources = \ 38 $(srcdir)/sources/css/brand.css \ 39 $(srcdir)/sources/css/common.css \ 40 $(srcdir)/sources/css/default.css \ 41 $(srcdir)/sources/css/epub.css \ 42 $(srcdir)/sources/css/print.css 43 44img_sources = \ 45 $(srcdir)/sources/images/icon.svg \ 46 $(srcdir)/sources/images/wayland.png 47 48doxygen_img_sources := \ 49 $(doxydir)/xml/wayland-architecture.png \ 50 $(doxydir)/xml/x-architecture.png 51 52map_sources := \ 53 $(doxydir)/xml/x-architecture.map \ 54 $(doxydir)/xml/wayland-architecture.map 55 56if HAVE_XMLTO 57if HAVE_XSLTPROC 58noinst_DATA = $(builddir)/Wayland $(publican_targets) 59XMLTO_PARAM = \ 60 --skip-validation \ 61 --stringparam chunk.section.depth=0 \ 62 --stringparam toc.section.depth=1 \ 63 --stringparam html.stylesheet=css/default.css 64 65# Listing various directories that might need to be created. 66alldirs := $(builddir)/en-US $(builddir)/en-US/images $(html_destdir) $(html_destdir)/css $(html_destdir)/images 67 68 69html_css_targets = $(addprefix $(html_destdir)/css/,$(notdir $(css_sources))) 70html_img_targets = $(addprefix $(html_destdir)/images/,$(notdir $(img_sources))) 71doxygen_img_targets := $(doxygen_img_sources:$(doxydir)/xml/%=$(html_destdir)/images/%) 72map_targets := $(map_sources:$(doxydir)/xml/%=$(builddir)/en-US/images/%) 73processed_targets := $(processed_sources:$(srcdir)/sources/%=$(builddir)/en-US/%) 74 75$(builddir)/Wayland: $(publican_targets) $(html_css_targets) $(html_img_targets) $(processed_targets) $(doxygen_img_targets) | $(builddir)/en-US 76 $(AM_V_GEN)$(XMLTO) $(XMLTO_PARAM) html $(builddir)/en-US/Wayland.xml -o $(html_destdir) 77 @touch $@ 78 79$(html_destdir)/css/%: $(srcdir)/sources/css/% | $(html_destdir)/css 80 $(AM_V_GEN)cp -f $< $@ 81 82$(html_destdir)/images/%: $(srcdir)/sources/images/% | $(html_destdir)/images 83 $(AM_V_GEN)cp -f $< $@ 84 85$(html_destdir)/images/%: $(doxydir)/xml/% | $(html_destdir)/images 86 $(AM_V_GEN)cp -f $< $@ 87 88pubdir = $(docdir)/Wayland/en-US 89 90publican_targets = $(publican_sources:$(srcdir)/sources/%=$(builddir)/en-US/%) \ 91 $(builddir)/en-US/ProtocolSpec.xml \ 92 $(builddir)/en-US/ProtocolInterfaces.xml \ 93 $(builddir)/en-US/ClientAPI.xml \ 94 $(builddir)/en-US/ServerAPI.xml 95 96# The Protocol.xml is purely generated and required before running publican 97$(builddir)/en-US/ProtocolSpec.xml: $(top_srcdir)/protocol/wayland.xml $(srcdir)/protocol-to-docbook.xsl | $(builddir)/en-US 98 $(AM_V_GEN)$(XSLTPROC) $(srcdir)/protocol-to-docbook.xsl \ 99 $(top_srcdir)/protocol/wayland.xml > $@ 100 101$(builddir)/en-US/ProtocolInterfaces.xml: $(top_srcdir)/protocol/wayland.xml $(srcdir)/protocol-interfaces-to-docbook.xsl | $(builddir)/en-US 102 $(AM_V_GEN)$(XSLTPROC) $(srcdir)/protocol-interfaces-to-docbook.xsl \ 103 $(top_srcdir)/protocol/wayland.xml > $@ 104 105# * use doxygen's combine.xslt to merge the xml files into one single file 106# * pipe that through the doxygen-to-publican stylesheet 107$(builddir)/en-US/%API.xml: $(doxydir)/xml/%/index.xml $(srcdir)/doxygen-to-publican.xsl | $(builddir)/en-US 108 $(AM_V_GEN)$(XSLTPROC) $(doxydir)/xml/$*/combine.xslt \ 109 $(doxydir)/xml/$*/index.xml | \ 110 $(XSLTPROC) --stringparam which $* \ 111 $(srcdir)/doxygen-to-publican.xsl - > $@ 112 113# Copy the sources source files into en-US destination 114# This is required for out-of-source-tree build as publican does not allow us 115# to specify the location of the source code. 116$(builddir)/en-US/%: $(srcdir)/sources/% $(publican_sources) | $(builddir)/en-US/images 117 $(AM_V_GEN)cp -f $< $@ 118 $(AM_V_at)chmod a+w $@ 119 120$(builddir)/en-US/images/%: $(doxydir)/xml/% | $(builddir)/en-US/images 121 $(AM_V_GEN)cp -f $< $@ 122 $(AM_V_at)chmod a+w $@ 123 124# More specific rule to override explicitly listed targets and perform xslt 125# modifications on them. 126# Note that we can't use $< as all targets must be there 127$(processed_targets): $(processed_sources) $(map_targets) $(srcdir)/merge-mapcoords.xsl | $(builddir)/en-US/images 128 $(AM_V_GEN)$(XSLTPROC) --stringparam basedir $(builddir)/en-US \ 129 $(srcdir)/merge-mapcoords.xsl $(addprefix $(srcdir)/sources/,$(notdir $@)) > $@ 130 131# general rule to create one of the listed directories. 132$(alldirs): 133 $(AM_V_GEN)$(MKDIR_P) $@ 134 135CLEANFILES = $(publican_targets) 136 137clean-local: 138 $(AM_V_at)rm -fr $(builddir)/en-US 139 $(AM_V_at)rm -fr $(builddir)/Wayland 140 141install-data-local: 142 test -z "$(pubdir)/html/css" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html/css" 143 test -z "$(pubdir)/html/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html/images" 144 list=`find $(builddir)/Wayland/en-US -type f`; \ 145 for p in $$list; do \ 146 echo " $(INSTALL_DATA) '$$p' '$(DESTDIR)$(docdir)/$$p'"; \ 147 $(INSTALL_DATA) "$$p" "$(DESTDIR)$(docdir)/$$p"; \ 148 done; 149 150uninstall-local: 151 @if test -n $(DESTDIR)$(docdir); then \ 152 if test -d $(DESTDIR)$(docdir); then \ 153 echo " rm -fr $(DESTDIR)$(docdir)/Wayland;"; \ 154 rm -fr $(DESTDIR)$(docdir)/Wayland; \ 155 fi; \ 156 fi; 157 158endif 159endif 160 161EXTRA_DIST = \ 162 $(publican_sources) $(processed_sources) $(css_sources) $(img_sources) \ 163 protocol-to-docbook.xsl \ 164 protocol-interfaces-to-docbook.xsl \ 165 doxygen-to-publican.xsl \ 166 merge-mapcoords.xsl 167