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