Doc: New part for the new program-flow extension, and an example with several uses.
[shapes.git] / doc / build / html / Makefile.am
blob687e65ea92d88083408210e724c72f6994985fbb
1 # This file is part of Shapes.
3 # Shapes is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # any later version.
8 # Shapes is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with Shapes.  If not, see <http://www.gnu.org/licenses/>.
16 # Copyright 2008 Gustaf Hendeby
18 docdir=../..
19 partsdir=${docdir}/parts
20 extensionsdir=${partsdir}/extensions
21 formatsdir=${partsdir}/formats
22 # Note: stylesdir must not be relative, or cyclic dependencies will result!
23 stylesdir=${top_srcdir}/doc/styles
24 toolsdir=${docdir}/tools
26 POSTPROC_HTML=${top_builddir}/doc/tools/postproc/postproc-html
28 SAXON = @SAXON@
30 SHAPES = $(top_builddir)/source/shapes
31 SHAPESFLAGS = --resources=no \
32               --fontmetricspath ${top_srcdir}/resources/fontmetrics \
33               --needpath ${top_srcdir}/resources/extensions \
34               --tp=no \
35               --tmpdir "/tmp/shapes.${USER}" --tmp*=yes
38 include ${top_builddir}/source/SHAPES-VERSION-FILE
40 DATE_PATTERN='[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}'
41 SSI=${top_builddir}/doc/tools/ssi/ssipp
42 # Setting BUILDDIR=^ means that paths will be relative to the current working
43 # directory.
44 SSIFLAGS=-dEXAMPLES=example/ -dBASE= -dBUILDDIR=^/ $(MORE_SSIFLAGS)
45 SSIFLAGS_EXTENSIONS=-dEXAMPLES=example/ -dBASE=../ -dBUILDDIR=^/ \
46                      $(MORE_SSIFLAGS) -I${srcdir}
47 MORE_SSIFLAGS=-dMODIFICATION_DATE=$(shell echo ${VERSION_DATE} | \
48              ${SED} -e 's!.*\('${DATE_PATTERN}'\).*!\1!' | \
49              grep -e ${DATE_PATTERN} 2> /dev/null || echo --- ) \
50                -dHTML_DOC_DIR=$(htmldir) -I${srcdir}
52 SHEXT_LIST=doc/blockdraw-tutorial-tut-prefs.shext doc/winding-rule-paths.shext
53 SHEXT_FILES=$(addprefix example/, $(SHEXT_LIST))
55 EXTRA_html_FILES = algo-tol.html bindings.html dynamic.html install.html \
56              man.html state-types.html states.html structure.html syntax.html types.html \
57              tutorial.html interactive.html index.html \
58              $(addprefix extensions/, numeric-constants.html basic-layout.html program-flow.html circle.html shapesarrow.html metapostarrow.html \
59                arrowheads.html blockdraw.html \
60                bondgraph.html conssupport.html \
61                linkpaths.html pathmapping.html shiftoff.html centering-X.html index.html )
63 nobase_dist_html_DATA = shapes.css
64 EXTRA_nobase_dist_html = ${html_FILES}
66 nobase_dist_noinst_DATA = ${extensionsdir}/formats/html.xsl \
67                    $(addprefix ${formatsdir}/, \
68                       examplecode-html.xsl html.xsl language-elements-html.xsl \
69                       man.xsl plain-book-html.xsl) \
70                          $(foreach part,\
71                      $(addprefix ${partsdir}/, \
72                              algo-tol bindings dynamic man states state-types \
73                          structure syntax tutorial interactive types index),\
74                      $(part)/formats/html.xsl $(wildcard $(part)/formats/*-html.xsl)) \
75                    $(patsubst ${srcdir}/%,%,\
76                            $(foreach part,\
77                        $(addprefix ${srcdir}/${partsdir}/, \
78                                algo-tol bindings dynamic man states state-types \
79                            structure syntax tutorial interactive types index),\
80                        $(part)/formats/html.xsl $(wildcard $(part)/formats/*-html.xsl))) \
81                    $(SHEXT_FILES)
83 EXTRA_DATA=${EXTRA_nobase_dist_html}
85 if HAVE_SAXON
86   html_FILES=${EXTRA_html_FILES}
87   nobase_dist_html_DATA+=${EXTRA_nobase_dist_html}
88 endif
90 # Temporary solution for putting the SF logo on each page:
91 ADD-SF: $(html_FILES)
92         -for i in $(html_FILES); do \
93           echo "Putting SF logo in " $$i; \
94           ex -sC $$i < insert-SF-logo.ex; \
95         done
97 extensions/%.xml : ${extensionsdir}/%.sxml ${DEPDIR}/extensions/%.ssidep
98         test -d  $(@D) || ${mkdir_p} $(@D)
99         if ${SSI} --in $< ${SSIFLAGS_EXTENSIONS} > extensions/$*.Txml; \
100         then \
101                 mv extensions/$*.Txml $@; \
102         else \
103                 ${RM} extensions/$*.Txml; \
104                 exit 1; \
105         fi
107 ${DEPDIR}/extensions/%.ssidep : ${extensionsdir}/%.sxml Makefile
108         test -d  $(@D) || ${mkdir_p} ${@D}
109         if $(SSI) --in $< $(SSIFLAGS_EXTENSIONS) --head extensions/$*.xml \
110           --deps > ${DEPDIR}/extensions/$*.Tssidep; \
111         then \
112                 ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
113                   ${DEPDIR}/extensions/$*.Tssidep > ${DEPDIR}/extensions/$*.dist ; \
114           ${SED} -e 's!^!$@ !' ${DEPDIR}/extensions/$*.Tssidep > $@ ; \
115                 mv ${DEPDIR}/extensions/$*.Tssidep $@; \
116         else \
117                 ${RM} ${DEPDIR}/extensions/$*.Tssidep; \
118                 exit 1; \
119         fi
121 # WARNING!
122 # Dependencies such as extensions/../dynamic.html will cause
123 # dynamic.html to be built as if it was the extension ../dynamic.html,
124 # which will produce the wrong result.  Therefore, we make an
125 # attempt at removing collapsable parts from the dependencies.
126 extensions/%.html : extensions/%.xml ${extensionsdir}/formats/html.xsl \
127                     ${formatsdir}/html.xsl
128         test -d  ${@D} || ${mkdir_p} ${@D} ; \
129         ( $(SAXON) $< $$( test -f ${extensionsdir}/formats/html.xsl || \
130           echo '${srcdir}'/ )${extensionsdir}/formats/html.xsl || exit 1 ) | \
131           ${POSTPROC_HTML} > $@
132         if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
133           echo '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl  > \
134            ${DEPDIR}/extensions/$*.Thtmldep ; \
135         then \
136                 echo "nobase_dist_html_DATA += $$( ${SED} -e 's!\([^ ]\{1,\}\)!extensions/\1!g' < ${DEPDIR}/extensions/$*.Thtmldep | ${SED} -e 's![^/ ]\{1,\}/\.\./!!g' | tr ' ' '\n' | sort -u | tr '\n' ' ' )" > ${DEPDIR}/extensions/$*.htmldep ; \
137                 ${RM} ${DEPDIR}/extensions/$*.Thtmldep ; \
138         else \
139                 ${RM} ${DEPDIR}/extensions/$*.Thtmldep ; \
140                 exit 1; \
141         fi
143 %.css : ${stylesdir}/html/%.css
144         test -d  $(@D) || ${mkdir_p} $(@D)
145         ${INSTALL_DATA} $< $@
147 example/%.shape : ${top_srcdir}/examples/%.shape
148         test -d  $(@D) || ${mkdir_p} $(@D)
149         ${INSTALL_DATA} $< $@
151 example/%.shext : ${top_srcdir}/examples/%.shext
152         test -d  $(@D) || ${mkdir_p} $(@D)
153         ${INSTALL_DATA} $< $@
155 %.htmldep : %.ssidep
156         @touch $@
158 .PRECIOUS : $(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep) \
159                                     $(html_FILES:.html=.htmldep) \
160                                     $(html_FILES:.html=.dist)) \
161             $(html_FILES:.html=.xml)
163 clean-local :
164         find . \( -name "*~" -o -name "*.html" -o -name "*.xml" \) -exec ${RM} {} \;
165         find ${DEPDIR} -type f -exec ${RM} {} \;
167 distclean-local :
168         -find . -type f -exec ${RM} {} \;
170 include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep))
171 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.htmldep))
172 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.dist))
174 # When including ../Makefile.common, we must first set up htmldepvar.
175 htmldepvar=nobase_dist_html_DATA
176 include ../Makefile.common
178 html-local : ${nobase_dist_html_DATA} ${nobase_dist_noinst_DATA} FORCE
179 dist-hook : all-local
180 all-local : html-local
181         ${MAKE} html-local
183 FORCE :