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 Gustaf Hendeby
19 partsdir=${docdir}/parts
20 extensionsdir=${partsdir}/extensions
21 formatsdir=${partsdir}/formats
22 stylesdir=${docdir}/styles
23 toolsdir=${docdir}/tools
25 POSTPROC_HTML=${top_builddir}/doc/tools/postproc/postproc-html
29 SHAPES = $(top_builddir)/source/shapes
30 SHAPESFLAGS = --resources=no \
31 --fontmetricspath ${top_srcdir}/resources/fontmetrics \
32 --needpath ${top_srcdir}/resources/extensions \
37 include ${top_builddir}/source/SHAPES-VERSION-FILE
39 DATE_PATTERN='[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}'
40 SSI=${top_builddir}/doc/tools/ssi/ssipp
41 # Setting BUILDDIR=^ means that paths will be relative to the current working
43 SSIFLAGS=-dEXAMPLES=example/ -dBASE=doc/ -dBUILDDIR=^/ $(MORE_SSIFLAGS)
44 MORE_SSIFLAGS=-dMODIFICATION_DATE=$(shell ${ECHO} $(VERSION_DATE) | \
45 ${SED} -e 's!.*\('${DATE_PATTERN}'\).*!\1!' | \
46 grep -e ${DATE_PATTERN} 2> /dev/null || ${ECHO} --- ) \
47 -dHTML_DOC_DIR=$(htmldir) -I${srcdir}
50 SHEXT_FILES=$(addprefix example/, $(SHEXT_LIST))
52 html_FILES = index.html
54 nobase_dist_html_DATA = ${html_FILES} logo.jpg
56 nobase_dist_noinst_DATA = ${extensionsdir}/formats/html.xsl \
57 $(addprefix ${formatsdir}/, \
58 examplecode-html.xsl html.xsl language-elements-html.xsl \
59 man.xsl plain-book-html.xsl) \
60 $(addprefix ${partsdir}/, \
61 $(addsuffix /formats/html.xsl, \
62 proj-web)) $(SHEXT_FILES)
64 index.xml : ${partsdir}/proj-web/index.sxml ${formatsdir}/html.xsl ${DEPDIR}/proj-web.ssidep
65 if ${SSI} --in $< ${SSIFLAGS} > index.Txml; \
73 ${DEPDIR}/%.ssidep : ${partsdir}/%/index.sxml Makefile
74 test -d $(@D) || ${mkdir_p} ${@D}
75 if $(SSI) --in $< $(SSIFLAGS) --head $*.xml --deps > \
76 ${DEPDIR}/$*.Tssidep; \
78 ${SED} -e 's!^.*:!nobase_dist_noinst_DATA += $< !' \
79 ${DEPDIR}/$*.Tssidep > ${DEPDIR}/$*.dist ; \
80 ${SED} -e 's!^!$@ !' ${DEPDIR}/$*.Tssidep > $@ ; \
81 mv ${DEPDIR}/$*.Tssidep $@; \
83 ${RM} ${DEPDIR}/$*.Tssidep; \
87 %.css : ${stylesdir}/html/%.css
88 test -d $(@D) || ${mkdir_p} $(@D)
91 %.jpg : ${partsdir}/proj-web/%.jpg
92 test -d $(@D) || ${mkdir_p} $(@D)
95 %.pdf %.stdout: %.shape $(SHEXT_FILES)
96 test -d $(@D) || ${mkdir_p} $(@D)
97 $(SHAPES) $(SHAPESFLAGS) --in $< --out $*.pdf > $*.stdout
99 %_3.pdf %.stdout: %.shape $(SHEXT_FILES)
100 test -d $(@D) || ${mkdir_p} $(@D)
101 $(SHAPES) $(SHAPESFLAGS) -vs1.3 --in $< --out $*_3.pdf > $*.stdout
103 # Some stupid versions of convert exit with a non-zero value even though the conversion was a success...
105 -convert -density 100 -resize $(shell ${ECHO} $@ | ${SED} -e 's!.*_\([^._]*\).jpg!\1!') $< $@
108 -convert -density 150 -resize x150 $< $@
111 -convert -density 50 -resize x50 $< $@
114 -convert -density 150 -resize 150x $< $@
117 -convert -density 50 -resize 50x $< $@
119 %.html : %.xml ${partsdir}/proj-web/formats/html.xsl ${formatsdir}/html.xsl
120 test -d ${@D} || ${mkdir_p} ${@D} ; \
121 ( $(SAXON) $< $$( test -f ${partsdir}/proj-web/formats/html.xsl || \
122 ${ECHO} '${srcdir}'/ )${partsdir}/proj-web/formats/html.xsl || exit 1 ) | \
123 ${POSTPROC_HTML} > $@
124 if $(SAXON) $@ $$( test -f ${toolsdir}/xhtml-deps/filter.xsl || \
125 ${ECHO} '${srcdir}'/)${toolsdir}/xhtml-deps/filter.xsl > \
126 ${DEPDIR}/proj-web.Thtmldep ; \
128 ${ECHO} "nobase_dist_html_DATA += $$( tr ' ' '\n' < ${DEPDIR}/proj-web.Thtmldep | sort -u | tr '\n' ' ' )" > ${DEPDIR}/proj-web.htmldep ; \
129 ${RM} ${DEPDIR}/proj-web.Thtmldep ; \
131 ${RM} ${DEPDIR}/proj-web.Thtmldep ; \
138 .PRECIOUS : $(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep) \
139 $(html_FILES:.html=.htmldep) \
140 $(html_FILES:.html=.dist)) \
141 $(html_FILES:.html=.xml)
144 find . \( -name "*~" -o -name "*.html" -o -name "*.xml" \) -exec ${RM} {} \;
145 find ${DEPDIR} -type f -exec ${RM} {} \;
148 -find . -type f -exec ${RM} {} \;
150 include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.ssidep))
151 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.htmldep))
152 -include $(addprefix ${DEPDIR}/, $(html_FILES:.html=.dist))
154 html-local : ${nobase_dist_html_DATA} ${nobase_dist_noinst_DATA} FORCE
156 all-local : html-local