comparison en/Makefile @ 693:0b45854f0b7b

Generate and include images properly.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 26 Mar 2009 22:00:53 -0700
parents 188efaefe001
children e0a4ba81f888
comparison
equal deleted inserted replaced
692:8dfdbe1cf982 693:0b45854f0b7b
1 # This makefile requires GNU make. 1 # This makefile requires GNU make.
2 2
3 image-sources := \ 3 image-sources := $(wildcard figs/*.dot figs/*.png figs/*.svg)
4 feature-branches.dot \
5 filelog.svg \
6 kdiff3.png \
7 metadata.svg \
8 mq-stack.svg \
9 note.png \
10 revlog.svg \
11 snapshot.svg \
12 tour-history.svg \
13 tour-merge-conflict.svg \
14 tour-merge-merge.svg \
15 tour-merge-pull.svg \
16 tour-merge-sep-repos.svg \
17 undo-manual.dot \
18 undo-manual-merge.dot \
19 undo-non-tip.dot \
20 undo-simple.dot \
21 wdir.svg \
22 wdir-after-commit.svg \
23 wdir-branch.svg \
24 wdir-merge.svg \
25 wdir-pre-branch.svg
26 4
27 xml-src-files := \ 5 xml-src-files := \
28 00book.xml \ 6 00book.xml \
29 app*.xml \ 7 app*.xml \
30 ch*.xml 8 ch*.xml
31 9
32 image-dot := $(filter %.dot,$(image-sources)) 10 image-dot := $(filter %.dot,$(image-sources))
33 image-svg := $(filter %.svg,$(image-sources)) 11 image-svg := $(filter %.svg,$(image-sources))
34 image-png := $(filter %.png,$(image-sources)) 12 image-png := $(filter %.png,$(image-sources))
35 13
36 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) 14 obj-web := html
15 obj-websup := $(obj-web)/support
16 obj-web-read := $(obj-web)/read
17
18 image-web := \
19 $(image-dot:%.dot=$(obj-web-read)/%.png) \
20 $(image-svg:%.svg=$(obj-web-read)/%.png) \
21 $(image-png:%=$(obj-web-read)/%)
37 22
38 example-sources-by-name := \ 23 example-sources-by-name := \
39 backout \ 24 backout \
40 bisect \ 25 bisect \
41 branching \ 26 branching \
69 54
70 example-sources := \ 55 example-sources := \
71 $(example-sources-by-name:%=examples/%) \ 56 $(example-sources-by-name:%=examples/%) \
72 $(wildcard examples/ch*/*) 57 $(wildcard examples/ch*/*)
73 58
74 obj-web := html
75 obj-websup := html/support
76
77 extras-web-base := \ 59 extras-web-base := \
78 $(obj-web)/index.html \ 60 $(obj-web)/index.html \
79 $(obj-web)/robots.txt \ 61 $(obj-web)/robots.txt \
80 $(obj-websup)/form-min.js \ 62 $(obj-websup)/form-min.js \
81 $(obj-websup)/form.js \ 63 $(obj-websup)/form.js \
133 ../xsl/system-xsl: $(system-xsl-dir) 115 ../xsl/system-xsl: $(system-xsl-dir)
134 ln -s $< $@ 116 ln -s $< $@
135 117
136 web: ../xsl/system-xsl websup html 118 web: ../xsl/system-xsl websup html
137 119
138 html: ../xsl/system-xsl $(xml-src-files) valid 120 html: $(obj-web-read)/index.html
139 xsltproc $(xsltproc-opts) -o html/read/x ../xsl/chunk-stylesheet.xsl 00book.xml 121
140 for i in html/read/*.html; do \ 122 $(obj-web-read)/index.html: ../xsl/system-xsl .validated-00book.xml
123 xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../xsl/chunk-stylesheet.xsl 00book.xml
124 for i in $(obj-web-read)/*.html; do \
141 gzip -9 -c $$i > $$i.gz; \ 125 gzip -9 -c $$i > $$i.gz; \
142 done 126 done
143 127
144 websup: $(extras-web) 128 websup: $(extras-web) $(image-web)
145 mkdir -p $(obj-websup)/figs 129 mkdir -p $(obj-websup)/figs $(obj-web-read)/figs
146 cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs 130 cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs
147 cp -f ../web/icons/*.png $(obj-websup)/figs 131 cp -f ../web/icons/*.png $(obj-websup)/figs
148 132
149 all-ids.dat: ../xsl/all-ids.xsl $(xml-src-files) 133 all-ids.dat: ../xsl/all-ids.xsl $(xml-src-files)
150 $(xsltproc) $(xsltproc-opts) -o $@ ../xsl/all-ids.xsl 00book.xml 134 $(xsltproc) $(xsltproc-opts) -o $@ ../xsl/all-ids.xsl 00book.xml
157 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $< 141 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
158 touch $@ 142 touch $@
159 143
160 # Produce 90dpi PNGs for the web. 144 # Produce 90dpi PNGs for the web.
161 145
162 %.png: %.svg fixsvg 146 $(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg
147 mkdir -p $(dir $@)
163 ./fixsvg $< 148 ./fixsvg $<
164 inkscape -D -e $@ $<-tmp.svg 149 inkscape -D -e $@ $<-tmp.svg
165 rm $<-tmp.svg 150 rm $<-tmp.svg
166 151
167 %.svg: %.dot 152 $(obj-web-read)/figs/%.png: figs/%.svg fixsvg
153 mkdir -p $(dir $@)
154 ./fixsvg $<
155 inkscape -D -e $@ $<-tmp.svg
156 rm $<-tmp.svg
157
158 $(obj-web-read)/figs/%.png: figs/%.png
159 cp $< $@
160
161 $(obj-web-read)/figs/%.svg: figs/%.dot
162 mkdir -p $(dir $@)
168 dot -Tsvg -o $@ $< 163 dot -Tsvg -o $@ $<
169 164
170 examples: $(example-prereqs) examples/.run 165 examples: $(example-prereqs) examples/.run
171 166
172 examples/.run: $(example-sources) 167 examples/.run: $(example-sources)