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
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 Gustaf Hendeby
19 partsdir=${docdir}/parts
20 extensionsdir=${partsdir}/extensions
21 namespacedir=${partsdir}/namespace
22 formatsdir=${partsdir}/formats
23 # Note: stylesdir must not be relative, or cyclic dependencies will result!
24 stylesdir=${top_srcdir}/doc/styles
25 toolsdir=${docdir}/tools
26 imagesdir=${docdir}/images
28 POSTPROC_HTML=${top_builddir}/doc/tools/postproc/postproc-html
32 SHAPES = $(top_builddir)/source/shapes
33 SHAPESFLAGS = --warn=error --resources=no \
34 --fontmetricspath ${top_srcdir}/resources/fontmetrics \
35 --needpath ${top_srcdir}/resources/extensions \
37 --tmpdir "/tmp/shapes.${USER}" --tmp*=yes
40 include ../Makefile.goalscheck
42 # In combination with ../Makefile.goalscheck, this how we include a file only if the make goal does not match *clean*:
43 include $(if $(findstring clean,$(MAKECMDGOALS)),,${top_builddir}/source/SHAPES-VERSION-FILE)
45 DATE_PATTERN='[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}'
46 VERSION_PATTERN='[0-9]\{1,\}\(\.[0-9]\{1,\}\)*\(-[a-z0-9]\{1,\}\)*'
47 SSI=${top_builddir}/doc/tools/ssi/ssipp
48 # Setting BUILDDIR=^ means that paths will be relative to the current working
50 SSIFLAGS=-dEXAMPLES=example/ -dBASE= -dBUILDDIR=^/ $(MORE_SSIFLAGS)
51 SSIFLAGS_DEPTH_1=-dEXAMPLES=example/ -dBASE=../ -dBUILDDIR=^/ \
52 $(MORE_SSIFLAGS) -I${srcdir}
53 MORE_SSIFLAGS=-dMODIFICATION_DATE=$(shell echo ${VERSION_DATE} | \
54 ${SED} -e 's!.*\('${DATE_PATTERN}'\).*!\1!' | \
55 grep -e ${DATE_PATTERN} 2> /dev/null || echo --- ) \
56 -dSHAPES_VERSION=$(shell echo ${VERSION_NUMBER} | \
57 ${SED} -e 's![^0-9]*\('${VERSION_PATTERN}'\).*!\1!' | \
58 grep -e ${VERSION_PATTERN} 2> /dev/null || echo ?.?.? ) \
59 -dHTML_DOC_DIR=$(htmldir) -I${srcdir}
61 SHEXT_LIST=doc/blockdraw-tutorial-tut-prefs.shext doc/winding-rule-paths.shext
62 SHEXT_FILES=$(addprefix example/, $(SHEXT_LIST))
65 algo-tol.html namespace-index.html bindings.html dynamic.html edit.html install.html \
66 man.html state-types.html states.html structure.html syntax.html types.html \
67 tutorial.html interactive.html index.html \
68 $(addprefix namespace/, \
71 Shapes-Data-Type.html \
73 Shapes-Geometry.html \
74 Shapes-Geometry3D.html \
75 Shapes-Graphics.html \
76 Shapes-Graphics-PDF.html \
77 Shapes-Graphics-Tag.html \
78 Shapes-Graphics3D.html \
82 Shapes-Numeric-Constant.html \
83 Shapes-Numeric-Math.html \
84 Shapes-Numeric-Random.html \
87 Shapes-Text-Font.html \
89 Shapes-Traits-BW.html \
90 Shapes-Traits-Blend.html \
91 Shapes-Traits-Cap.html \
92 Shapes-Traits-Device.html \
93 Shapes-Traits-Join.html \
94 Shapes-Traits-Light.html \
95 Shapes-Traits-RGB.html \
97 Applications-Blockdraw.html \
99 $(addprefix extensions/, \
101 Applications-Blockdraw-blockdraw.html \
102 Applications-Blockdraw-bondgraph.html \
103 Shapes-Control-cond.html \
104 Shapes-Data-conssupport.html \
105 Shapes-Geometry-circle.html \
106 Shapes-Geometry-linkpaths.html \
107 Shapes-Geometry-pathmapping.html \
108 Shapes-Geometry3D-circle.html \
109 Shapes-Graphics-arrowheads.html \
110 Shapes-Graphics-metapostarrow.html \
111 Shapes-Graphics-shapesarrow.html \
112 Shapes-Graphics3D-arrowheads.html \
113 Shapes-Graphics3D-metapostarrow.html \
114 Shapes-Layout-basic-layout.html \
115 Shapes-Layout-centering-X.html \
116 Shapes-Layout-shiftoff.html \
117 Shapes-Numeric-Constant-constants.html \
120 nobase_dist_html_DATA = shapes.css toc-miss.html
121 EXTRA_nobase_dist_html = ${html_FILES}
123 nobase_dist_noinst_DATA = ${extensionsdir}/formats/html.xsl \
124 ${namespacedir}/formats/html.xsl \
125 $(addprefix ${formatsdir}/, \
126 examplecode-html.xsl html.xsl language-elements-html.xsl \
127 man.xsl plain-book-html.xsl) \
128 ${partsdir}/namespace-toc/formats/toc.xsl \
130 $(addprefix ${partsdir}/, \
131 algo-tol namespace-index bindings dynamic edit man states state-types \
132 structure syntax tutorial interactive types index),\
133 $(part)/formats/html.xsl $(wildcard $(part)/formats/*-html.xsl)) \
134 $(patsubst ${srcdir}/%,%,\
136 $(addprefix ${srcdir}/${partsdir}/, \
137 algo-tol namespace-index bindings dynamic edit man states state-types \
138 structure syntax tutorial interactive types index),\
139 $(part)/formats/html.xsl $(wildcard $(part)/formats/*-html.xsl))) \
142 EXTRA_DATA=${EXTRA_nobase_dist_html}
144 html_FILES=${EXTRA_html_FILES}
145 nobase_dist_html_DATA+=${EXTRA_nobase_dist_html}
147 EXTRA_DIST=${nobase_dist_html_DATA}
149 # Temporary solution for putting the SF logo on each page:
150 ADD-SF: $(html_FILES)
151 -for i in $(html_FILES); do \
152 echo "Putting SF logo in " $$i; \
153 ex -sC $$i < insert-SF-logo.ex; \
156 extensions/%.xml : ${extensionsdir}/%.sxml ${DEPDIR}/extensions/%.ssidep
157 test -d $(@D) || ${mkdir_p} $(@D)
158 if ${SSI} --in $< ${SSIFLAGS_DEPTH_1} > extensions/$*.Txml; \
160 mv extensions/$*.Txml $@; \
162 ${RM} extensions/$*.Txml; \
166 ${DEPDIR}/extensions/%.ssidep : ${extensionsdir}/%.sxml Makefile
167 test -d $(@D) || ${mkdir_p} ${@D}
168 if $(SSI) --in $< $(SSIFLAGS_DEPTH_1) --head extensions/$*.xml \
169 --deps > ${DEPDIR}/extensions/$*.Tssidep; \
171 ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
172 ${DEPDIR}/extensions/$*.Tssidep > ${DEPDIR}/extensions/$*.dist ; \
173 ${SED} -e 's!^!$@ !' ${DEPDIR}/extensions/$*.Tssidep > $@ ; \
174 mv ${DEPDIR}/extensions/$*.Tssidep $@; \
176 ${RM} ${DEPDIR}/extensions/$*.Tssidep; \
180 namespace/%.xml : ${namespacedir}/%.sxml ${DEPDIR}/namespace/%.ssidep
181 test -d $(@D) || ${mkdir_p} $(@D)
182 if ${SSI} --in $< ${SSIFLAGS_DEPTH_1} > namespace/$*.Txml; \
184 mv namespace/$*.Txml $@; \
186 ${RM} namespace/$*.Txml; \
190 ${DEPDIR}/namespace/%.ssidep : ${namespacedir}/%.sxml Makefile
191 test -d $(@D) || ${mkdir_p} ${@D}
192 if $(SSI) --in $< $(SSIFLAGS_DEPTH_1) --head namespace/$*.xml \
193 --deps > ${DEPDIR}/namespace/$*.Tssidep; \
195 ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
196 ${DEPDIR}/namespace/$*.Tssidep > ${DEPDIR}/namespace/$*.dist ; \
197 ${SED} -e 's!^!$@ !' ${DEPDIR}/namespace/$*.Tssidep > $@ ; \
198 mv ${DEPDIR}/namespace/$*.Tssidep $@; \
200 ${RM} ${DEPDIR}/namespace/$*.Tssidep; \
205 # Dependencies such as extensions/../dynamic.html will cause
206 # dynamic.html to be built as if it was the extension ../dynamic.html,
207 # which will produce the wrong result. Therefore, we make an
208 # attempt at removing collapsable parts from the dependencies.
211 extensions/%.html : extensions/%.xml ${extensionsdir}/formats/html.xsl \
212 ${formatsdir}/html.xsl
213 test -d ${@D} || ${mkdir_p} ${@D} ; \
214 ( $(SAXON) $< $$( test -f ${extensionsdir}/formats/html.xsl || \
215 echo '${srcdir}'/ )${extensionsdir}/formats/html.xsl || exit 1 ) | \
216 ${POSTPROC_HTML} > $@
217 if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
218 echo '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl > \
219 ${DEPDIR}/extensions/$*.Thtmldep ; \
221 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 ; \
222 ${RM} ${DEPDIR}/extensions/$*.Thtmldep ; \
224 ${RM} ${DEPDIR}/extensions/$*.Thtmldep ; \
228 namespace/%.html : namespace/%.xml ${namespacedir}/formats/html.xsl \
229 ${formatsdir}/html.xsl
230 test -d ${@D} || ${mkdir_p} ${@D} ; \
231 ( $(SAXON) $< $$( test -f ${namespacedir}/formats/html.xsl || \
232 echo '${srcdir}'/ )${namespacedir}/formats/html.xsl || exit 1 ) | \
233 ${POSTPROC_HTML} > $@
234 if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
235 echo '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl > \
236 ${DEPDIR}/namespace/$*.Thtmldep ; \
238 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 ; \
239 ${RM} ${DEPDIR}/namespace/$*.Thtmldep ; \
241 ${RM} ${DEPDIR}/namespace/$*.Thtmldep ; \
247 %.css : ${stylesdir}/html/%.css
248 test -d $(@D) || ${mkdir_p} $(@D)
249 ${INSTALL_DATA} $< $@
251 toc-miss.html : ${partsdir}/namespace-toc/toc-miss.html
252 test -d $(@D) || ${mkdir_p} $(@D)
253 ${INSTALL_DATA} $< $@
255 img/% : ${imagesdir}/%
256 test -d $(@D) || ${mkdir_p} $(@D)
257 ${INSTALL_DATA} $< $@
259 img/%-www.jpg : img/%.png
260 convert $(CONVERT_FLAGS) -scale 30% $< $@
262 example/%.shape : ${top_srcdir}/examples/%.shape
263 test -d $(@D) || ${mkdir_p} $(@D)
264 ${INSTALL_DATA} $< $@
266 example/%.blank : ${top_srcdir}/examples/%.blank
267 test -d $(@D) || ${mkdir_p} $(@D)
268 ${INSTALL_DATA} $< $@
270 example/%.shext : ${top_srcdir}/examples/%.shext
271 test -d $(@D) || ${mkdir_p} $(@D)
272 ${INSTALL_DATA} $< $@
277 .PRECIOUS : $(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep) \
278 $(html_FILES:.html=.htmldep) \
279 $(html_FILES:.html=.dist)) \
280 $(html_FILES:.html=.xml)
283 -find . \( -name "*~" -o -name "*.html" -o -name "*.xml" \) -exec ${RM} {} \;
284 -test -d ${DEPDIR} && find ${DEPDIR} -type f -exec ${RM} {} \;
287 -find . -type f -exec ${RM} {} \;
289 # In combination with ../Makefile.goalscheck, this how we include a file only if the make goal does not match *clean*:
290 include $(if $(findstring clean,$(MAKECMDGOALS)),,$(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep)))
292 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.htmldep))
293 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.dist))
295 # When including ../Makefile.common, we must first set up htmldepvar.
296 htmldepvar=nobase_dist_html_DATA
297 include ../Makefile.common
299 html-local : ${nobase_dist_html_DATA} ${nobase_dist_noinst_DATA} FORCE
300 dist-hook : all-local
301 all-local : html-local