Updating the changelog in the VERSION file, and version_sync
[shapes.git] / doc / build / html / Makefile.am
blob6ba93f8e864e0837ca7957eea85f283f19bb5f32
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, 2010, 2013 Gustaf Hendeby
18 docdir = ../..
19 partsdir = ${docdir}/parts
20 extensionsdir = ${partsdir}/extensions
21 namespacedir = ${partsdir}/namespace
22 guidesdir = ${partsdir}/guides
23 formatsdir = ${partsdir}/formats
24 # Note: stylesdir must not be relative, or cyclic dependencies will result!
25 stylesdir = ${top_srcdir}/doc/styles
26 toolsdir = ${docdir}/tools
27 imagesdir = ${docdir}/images
29 POSTPROC_HTML = ${top_builddir}/doc/tools/postproc/postproc-html
31 SAXON = @SAXON@
33 SHAPES = $(top_builddir)/source/shapes
34 SHAPESFLAGS = --warn=error --resources=no \
35               --fontmetricspath ${top_srcdir}/resources/fontmetrics \
36               --needpath ${top_srcdir}/resources/extensions \
37               --tp=no \
38               --tmpdir "/tmp/shapes.${USER}" --tmp*=yes
41 include ../Makefile.goalscheck
43 # In combination with ../Makefile.goalscheck, this how we include a file only if the make goal does not match *clean*:
44 include $(if $(findstring clean,$(MAKECMDGOALS)),,${top_builddir}/source/SHAPES-VERSION-FILE)
46 DATE_PATTERN = '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}'
47 VERSION_PATTERN = '[0-9]\{1,\}\(\.[0-9]\{1,\}\)*\(-[a-z0-9]\{1,\}\)*'
48 SSI = ${top_builddir}/doc/tools/ssi/ssipp
49 # Setting BUILDDIR=^ means that paths will be relative to the current working
50 # directory.
51 SSIFLAGS = -dEXAMPLES=example/ -dBASE= -dBUILDDIR=^/ $(MORE_SSIFLAGS)
52 SSIFLAGS_SUBTOPIC = -dEXAMPLES=example/ -dBASE=../ -dBUILDDIR=^/ \
53                      $(MORE_SSIFLAGS) -I${srcdir}
54 MORE_SSIFLAGS = -dMODIFICATION_DATE=$(shell echo ${VERSION_DATE} | \
55              ${SED} -e 's!.*\('${DATE_PATTERN}'\).*!\1!' | \
56              grep -e ${DATE_PATTERN} 2> /dev/null || echo --- ) \
57                -dSHAPES_VERSION=$(shell echo ${VERSION_NUMBER} | \
58              ${SED} -e 's![^0-9]*\('${VERSION_PATTERN}'\).*!\1!' | \
59              grep -e ${VERSION_PATTERN} 2> /dev/null || echo ?.?.? ) \
60                -dHTML_DOC_DIR=$(htmldir) -I${srcdir}
62 SHEXT_LIST = doc/blockdraw-tutorial-tut-prefs.shext doc/winding-rule-paths.shext
63 SHEXT_FILES = $(addprefix example/, $(SHEXT_LIST))
65 EXTRA_html_FILES = \
66   algo-tol.html namespace-index.html edit.html install.html \
67   man.html state-types.html structure.html syntax.html types.html \
68   tutorial.html interactive.html index.html \
69   $(addprefix namespace/, \
70     Shapes.html \
71     Shapes-Control.html \
72     Shapes-Data.html \
73     Shapes-Data-Type.html \
74     Shapes-Debug.html \
75     Shapes-Geometry.html \
76     Shapes-Geometry3D.html \
77     Shapes-Graphics.html \
78     Shapes-Graphics-PDF.html \
79     Shapes-Graphics-Tag.html \
80     Shapes-Graphics3D.html \
81     Shapes-IO.html \
82     Shapes-Layout.html \
83     Shapes-Numeric.html \
84     Shapes-Numeric-Constant.html \
85     Shapes-Numeric-Math.html \
86     Shapes-Numeric-Random.html \
87     Shapes-String.html \
88     Shapes-Text.html \
89     Shapes-Text-Font.html \
90     Shapes-Traits.html \
91     Shapes-Traits-BW.html \
92     Shapes-Traits-Blend.html \
93     Shapes-Traits-Cap.html \
94     Shapes-Traits-Device.html \
95     Shapes-Traits-Join.html \
96     Shapes-Traits-Light.html \
97     Shapes-Traits-RGB.html \
98     Applications.html \
99     Applications-Blockdraw.html \
100   ) \
101   $(addprefix extensions/, \
102     Applications-Blockdraw-blockdraw.html \
103     Applications-Blockdraw-bondgraph.html \
104     Shapes-Control-cond.html \
105     Shapes-Data-seq-support.html \
106     Shapes-Geometry-circle.html \
107     Shapes-Geometry-linkpaths.html \
108     Shapes-Geometry-pathmapping.html \
109     Shapes-Geometry3D-circle.html \
110     Shapes-Graphics-arrowheads.html \
111     Shapes-Graphics-metapostarrow.html \
112     Shapes-Graphics-shapesarrow.html \
113     Shapes-Graphics3D-arrowheads.html \
114     Shapes-Graphics3D-metapostarrow.html \
115     Shapes-Layout-basic-layout.html \
116     Shapes-Layout-centering-X.html \
117     Shapes-Layout-shiftoff.html \
118     Shapes-Numeric-Constant-constants.html \
119   ) \
120   $(addprefix guides/, \
121     paths.html 3D.html text.html graphs.html hierarchical.html index.html)
123 nobase_dist_html_DATA = shapes.css toc-miss.html
124 EXTRA_nobase_dist_html = ${html_FILES}
126 nobase_dist_noinst_DATA = \
127   ${extensionsdir}/formats/html.xsl \
128   ${namespacedir}/formats/html.xsl \
129   ${guidesdir}/formats/html.xsl \
130   $(addprefix ${formatsdir}/, \
131      examplecode-html.xsl html.xsl language-elements-html.xsl \
132      bindings-html.xsl man.xsl plain-book-html.xsl) \
133   ${partsdir}/namespace-toc/formats/toc.xsl \
134   $(foreach part,\
135     $(addprefix ${partsdir}/, \
136       algo-tol namespace-index edit man state-types \
137         structure syntax tutorial interactive types index),\
138     $(part)/formats/html.xsl $(wildcard $(part)/formats/*-html.xsl)) \
139   $(patsubst ${srcdir}/%,%,\
140     $(foreach part,\
141       $(addprefix ${srcdir}/${partsdir}/, \
142         algo-tol namespace-index edit man state-types \
143           structure syntax tutorial interactive types index),\
144       $(part)/formats/html.xsl $(wildcard $(part)/formats/*-html.xsl))) \
145   $(SHEXT_FILES) \
146   ${partsdir}/namespace-toc/toc-miss.html
148 EXTRA_DATA = ${EXTRA_nobase_dist_html}
150 html_FILES = ${EXTRA_html_FILES}
151 nobase_dist_html_DATA += ${EXTRA_nobase_dist_html}
153 EXTRA_DIST = ${nobase_dist_html_DATA}
155 # Temporary solution for putting the SF logo on each page:
156 ADD-SF: $(html_FILES)
157         -for i in $(html_FILES); do \
158     echo "Putting SF logo in " $$i; \
159     ex -sC $$i < insert-SF-logo.ex; \
160   done
162 guides/%.xml : ${guidesdir}/%.sxml ${DEPDIR}/guides/%.ssidep
163         test -d $(@D) || ${mkdir_p} $(@D)
164         if ${SSI} --in $< ${SSIFLAGS_SUBTOPIC} > guides/$*.Txml; \
165   then \
166     mv guides/$*.Txml $@; \
167   else \
168     ${RM} guides/$*.Txml; \
169     exit 1; \
170   fi
172 namespace/%.xml : ${namespacedir}/%.sxml ${DEPDIR}/namespace/%.ssidep
173         test -d $(@D) || ${mkdir_p} $(@D)
174         if ${SSI} --in $< ${SSIFLAGS_SUBTOPIC} > namespace/$*.Txml; \
175   then \
176     mv namespace/$*.Txml $@; \
177   else \
178     ${RM} namespace/$*.Txml; \
179     exit 1; \
180   fi
182 extensions/%.xml : ${extensionsdir}/%.sxml ${DEPDIR}/extensions/%.ssidep
183         test -d $(@D) || ${mkdir_p} $(@D)
184         if ${SSI} --in $< ${SSIFLAGS_SUBTOPIC} > extensions/$*.Txml; \
185   then \
186     mv extensions/$*.Txml $@; \
187   else \
188     ${RM} extensions/$*.Txml; \
189     exit 1; \
190   fi
192 ${DEPDIR}/guides/%.ssidep : ${guidesdir}/%.sxml toc.xml Makefile
193         test -d $(@D) || ${mkdir_p} ${@D}
194         if $(SSI) --in $< $(SSIFLAGS_SUBTOPIC) --head guides/$*.xml \
195     --deps > ${DEPDIR}/guides/$*.Tssidep; \
196   then \
197     ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
198       ${DEPDIR}/guides/$*.Tssidep > ${DEPDIR}/guides/$*.dist ; \
199     ${SED} -e 's!^!$@ !' ${DEPDIR}/guides/$*.Tssidep > $@ ; \
200     mv ${DEPDIR}/guides/$*.Tssidep $@; \
201   else \
202     ${RM} ${DEPDIR}/guides/$*.Tssidep; \
203     exit 1; \
204   fi
206 ${DEPDIR}/namespace/%.ssidep : ${namespacedir}/%.sxml toc.xml Makefile
207         test -d $(@D) || ${mkdir_p} ${@D}
208         if $(SSI) --in $< $(SSIFLAGS_SUBTOPIC) --head namespace/$*.xml \
209     --deps > ${DEPDIR}/namespace/$*.Tssidep; \
210   then \
211     ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
212       ${DEPDIR}/namespace/$*.Tssidep > ${DEPDIR}/namespace/$*.dist ; \
213     ${SED} -e 's!^!$@ !' ${DEPDIR}/namespace/$*.Tssidep > $@ ; \
214     mv ${DEPDIR}/namespace/$*.Tssidep $@; \
215   else \
216     ${RM} ${DEPDIR}/namespace/$*.Tssidep; \
217     exit 1; \
218   fi
220 ${DEPDIR}/extensions/%.ssidep : ${extensionsdir}/%.sxml toc.xml Makefile
221         test -d $(@D) || ${mkdir_p} ${@D}
222         if $(SSI) --in $< $(SSIFLAGS_SUBTOPIC) --head extensions/$*.xml \
223     --deps > ${DEPDIR}/extensions/$*.Tssidep; \
224   then \
225     ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
226       ${DEPDIR}/extensions/$*.Tssidep > ${DEPDIR}/extensions/$*.dist ; \
227     ${SED} -e 's!^!$@ !' ${DEPDIR}/extensions/$*.Tssidep > $@ ; \
228     mv ${DEPDIR}/extensions/$*.Tssidep $@; \
229   else \
230     ${RM} ${DEPDIR}/extensions/$*.Tssidep; \
231     exit 1; \
232   fi
234 # WARNING!
235 # Dependencies such as extensions/../dynamic.html will cause
236 # dynamic.html to be built as if it was the extension ../dynamic.html,
237 # which will produce the wrong result.  Therefore, we make an
238 # attempt at removing collapsable parts from the dependencies.
239 if HAVE_SAXON
241 extensions/%.html : extensions/%.xml ${extensionsdir}/formats/html.xsl \
242                     ${formatsdir}/html.xsl
243         test -d ${@D} || ${mkdir_p} ${@D} ; \
244     ( $(SAXON) $< $$( test -f ${extensionsdir}/formats/html.xsl || \
245       echo '${srcdir}'/ )${extensionsdir}/formats/html.xsl || exit 1 ) | \
246     ${POSTPROC_HTML} > $@
247         if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
248     echo '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl > \
249       ${DEPDIR}/extensions/$*.Thtmldep ; \
250   then \
251     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 ; \
252     ${RM} ${DEPDIR}/extensions/$*.Thtmldep; \
253   else \
254     ${RM} ${DEPDIR}/extensions/$*.Thtmldep; \
255     exit 1; \
256   fi
258 namespace/%.html : namespace/%.xml ${namespacedir}/formats/html.xsl \
259                     ${formatsdir}/html.xsl
260         test -d ${@D} || ${mkdir_p} ${@D} ; \
261     ( $(SAXON) $< $$( test -f ${namespacedir}/formats/html.xsl || \
262       echo '${srcdir}'/ )${namespacedir}/formats/html.xsl || exit 1 ) | \
263     ${POSTPROC_HTML} > $@
264         if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
265     echo '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl > \
266       ${DEPDIR}/namespace/$*.Thtmldep ; \
267   then \
268     echo "nobase_dist_html_DATA += $$( ${SED} -e 's!\([^ ]\{1,\}\)!namespace/\1!g' < ${DEPDIR}/namespace/$*.Thtmldep | ${SED} -e 's![^/ ]\{1,\}/\.\./!!g' | tr ' ' '\n' | sort -u | tr '\n' ' ' )" > ${DEPDIR}/namespace/$*.htmldep ; \
269     ${RM} ${DEPDIR}/namespace/$*.Thtmldep; \
270   else \
271     ${RM} ${DEPDIR}/namespace/$*.Thtmldep; \
272     exit 1; \
273   fi
275 guides/%.html : guides/%.xml ${guidesdir}/formats/html.xsl \
276                     ${formatsdir}/html.xsl
277         test -d ${@D} || ${mkdir_p} ${@D} ; \
278     ( $(SAXON) $< $$( test -f ${guidesdir}/formats/html.xsl || \
279       echo '${srcdir}'/ )${guidesdir}/formats/html.xsl || exit 1 ) | \
280     ${POSTPROC_HTML} > $@
281         if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
282     echo '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl > \
283       ${DEPDIR}/guides/$*.Thtmldep ; \
284   then \
285     echo "nobase_dist_html_DATA += $$( ${SED} -e 's!\([^ ]\{1,\}\)!guides/\1!g' < ${DEPDIR}/guides/$*.Thtmldep | ${SED} -e 's![^/ ]\{1,\}/\.\./!!g' | tr ' ' '\n' | sort -u | tr '\n' ' ' )" > ${DEPDIR}/guides/$*.htmldep ; \
286     ${RM} ${DEPDIR}/guides/$*.Thtmldep; \
287   else \
288     ${RM} ${DEPDIR}/guides/$*.Thtmldep; \
289     exit 1; \
290   fi
292 endif # HAVE_SAXON
294 %.css : ${stylesdir}/html/%.css
295         test -d $(@D) || ${mkdir_p} $(@D)
296         ${INSTALL_DATA} $< $@
298 toc-miss.html : ${partsdir}/namespace-toc/toc-miss.html
299         test -d $(@D) || ${mkdir_p} $(@D)
300         ${INSTALL_DATA} $< $@
302 img/% : ${imagesdir}/%
303         test -d $(@D) || ${mkdir_p} $(@D)
304         ${INSTALL_DATA} $< $@
306 img/%-www.jpg : img/%.png
307         convert $(CONVERT_FLAGS) -scale 30% $< $@
309 example/%.shape : ${top_srcdir}/examples/%.shape
310         test -d $(@D) || ${mkdir_p} $(@D)
311         ${INSTALL_DATA} $< $@
313 example/%.blank : ${top_srcdir}/examples/%.blank
314         test -d $(@D) || ${mkdir_p} $(@D)
315         ${INSTALL_DATA} $< $@
317 example/%.shext : ${top_srcdir}/examples/%.shext
318         test -d $(@D) || ${mkdir_p} $(@D)
319         ${INSTALL_DATA} $< $@
321 %.htmldep : %.ssidep
322         @touch $@
324 .PRECIOUS : $(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep) \
325                                     $(html_FILES:.html=.htmldep) \
326                                     $(html_FILES:.html=.dist) \
327                                     namespace-toc.ssidep namespace-toc.dist) \
328             $(html_FILES:.html=.xml \
329             namespace-toc.xml)
331 clean-local :
332         -find . \( -name "*~" -o -name "*.html" -o -name "*.xml" -o -name "*.css" \) -exec ${RM} {} \;
333         -test -d ${DEPDIR} && find ${DEPDIR} -type f -exec ${RM} {} \;
335 distclean-local :
336         -find . -type f -exec ${RM} {} \;
338 # In combination with ../Makefile.goalscheck, this how we include a file only if the make goal does not match *clean*:
339 include $(if $(findstring clean,$(MAKECMDGOALS)),,$(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep)))
341 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.htmldep))
342 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.dist))
343 -include $(addprefix ${DEPDIR}/, namespace-toc.dist)
345 # When including ../Makefile.common, we must first set up htmldepvar.
346 htmldepvar = nobase_dist_html_DATA
347 include ../Makefile.common
349 html-local : ${nobase_dist_html_DATA} ${nobase_dist_noinst_DATA} FORCE
350 dist-hook : all-local
351 all-local : html-local
352         ${MAKE} html-local
354 FORCE :