hgbook

view en/Makefile @ 679:06458701453c

Fix up some links to example URLs that aren't actually real.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue Apr 21 21:07:20 2009 -0700 (2009-04-21)
parents 1c13ed2130a7 fbb4340be17a
children 88828b784971
line source
1 # This makefile requires GNU make.
3 image-sources := $(wildcard figs/*.dot figs/*.gif figs/*.png figs/*.svg)
5 xml-src-files := \
6 00book.xml \
7 app*.xml \
8 ch*.xml
10 image-dot := $(filter %.dot,$(image-sources))
11 image-svg := $(filter %.svg,$(image-sources))
12 image-oth := $(filter %.gif %.png,$(image-sources))
14 obj-web := html
15 obj-websup := $(obj-web)/support
16 obj-web-read := $(obj-web)/read
18 image-web := \
19 $(image-dot:%.dot=$(obj-web-read)/%.png) \
20 $(image-svg:%.svg=$(obj-web-read)/%.png) \
21 $(image-oth:%=$(obj-web-read)/%)
23 example-sources-by-name := \
24 backout \
25 bisect \
26 branching \
27 branch-named \
28 branch-repo \
29 cmdref \
30 daily.copy \
31 daily.files \
32 daily.rename \
33 daily.revert \
34 extdiff \
35 filenames \
36 hook.msglen \
37 hook.simple \
38 hook.ws \
39 issue29 \
40 mq.guards \
41 mq.qinit-help \
42 mq.dodiff \
43 mq.id \
44 mq.tarball \
45 mq.tools \
46 mq.tutorial \
47 rename.divergent \
48 rollback \
49 tag \
50 template.simple \
51 template.svnstyle \
52 tour \
53 tour-merge-conflict
55 example-sources := \
56 $(example-sources-by-name:%=examples/%) \
57 $(wildcard examples/ch*/*)
59 extras-web-base := \
60 $(obj-web)/index.html \
61 $(obj-web)/robots.txt \
62 $(obj-websup)/form-min.js \
63 $(obj-websup)/form.js \
64 $(obj-websup)/hsbook.js \
65 $(obj-websup)/jquery-min.js \
66 $(obj-websup)/jquery.js \
67 $(obj-websup)/styles.css
69 extras-web := $(extras-web-base) $(extras-web-base:%=%.gz)
71 xsltproc := xsltproc
72 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
74 xmllint := xmllint
75 xmllint-opts := --noout --nonet --valid
77 system-xsl-dir := $(firstword $(wildcard \
78 /usr/share/sgml/docbook/xsl-stylesheets \
79 /usr/share/xml/docbook/stylesheet/nwalsh \
80 ))
82 # Bletcherousness.
84 ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),)
85 dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*)
86 else
87 ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),)
88 dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4)
89 else
90 $(error Do not know where to look for DocBook XML 4.4 DTD)
91 endif
92 endif
94 ifeq ($(system-xsl-dir),)
95 $(error add a suitable directory to system-xsl-dir)
96 endif
98 example-prereqs := \
99 /usr/bin/merge
101 dist-sources := \
102 ../html/hgicon.png \
103 ../html/index.html.var \
104 ../html/index.en.html
106 hg = $(shell which hg)
108 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n')
110 hg-version = $(shell hg version -q | \
111 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
113 all: web complete.xml
115 ../stylesheets/system-xsl: $(system-xsl-dir)
116 ln -s $< $@
118 web: ../stylesheets/system-xsl websup html
120 html: $(obj-web-read)/index.html
122 ../web/index-read.html.in: ../web/genindex.py $(xml-src-files)
123 cd ../web && ./genindex.py
125 $(obj-web-read)/index.html: ../stylesheets/system-xsl .validated-00book.xml ../web/index-read.html.in
126 xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../stylesheets/chunk-stylesheet.xsl 00book.xml
127 python ../web/texpand.py ../web/index-read.html.in html/read/index.html
128 for i in $(obj-web-read)/*.html; do \
129 gzip -9 -c $$i > $$i.gz; \
130 done
132 websup: $(extras-web) $(image-web)
133 mkdir -p $(obj-websup)/figs $(obj-web-read)/figs
134 cp ../stylesheets/system-xsl/images/*.png $(obj-websup)/figs
135 cp -f ../web/icons/*.png $(obj-websup)/figs
137 complete.xml: .validated-00book.xml
138 $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/dtd-profile.xsl 00book.xml
140 all-ids.dat: ../stylesheets/all-ids.xsl $(xml-src-files)
141 $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/all-ids.xsl 00book.xml
143 web: websup
145 valid: .validated-00book.xml
147 .validated-00book.xml: $(xml-src-files) examples/.run
148 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
149 touch $@
151 # Produce 90dpi PNGs for the web.
153 $(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg
154 mkdir -p $(dir $@)
155 ./fixsvg $<
156 inkscape -D -e $@ $<-tmp.svg
157 rm $<-tmp.svg
159 $(obj-web-read)/figs/%.png: figs/%.svg fixsvg
160 mkdir -p $(dir $@)
161 ./fixsvg $<
162 inkscape -D -e $@ $<-tmp.svg
163 rm $<-tmp.svg
165 $(obj-web-read)/figs/%.gif: figs/%.gif
166 cp $< $@
168 $(obj-web-read)/figs/%.png: figs/%.png
169 cp $< $@
171 $(obj-web-read)/figs/%.svg: figs/%.dot
172 mkdir -p $(dir $@)
173 dot -Tsvg -o $@ $<
175 examples: $(example-prereqs) examples/.run
177 examples/.run: $(example-sources)
178 cd examples && ./run-example -a
180 examples/%.run: examples/% examples/run-example
182 clean:
183 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
184 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
186 install: html $(dist-sources)
187 rm -rf dist
188 mkdir -p dist
189 cp html/*.{css,html,png} dist
190 cp $(dist-sources) dist
192 rsync: install
193 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
195 vpath %.css ../web
196 vpath %.html.in ../web
197 vpath %.js ../web/javascript
199 $(obj-websup)/%.css: %.css
200 @mkdir -p $(dir $@)
201 cp $< $@
203 $(obj-websup)/%.jpg: %.jpg
204 @mkdir -p $(dir $@)
205 cp $< $@
207 $(obj-websup)/%.js: %.js
208 @mkdir -p $(dir $@)
209 cp $< $@
211 $(obj-web)/%: ../web/%
212 @mkdir -p $(dir $@)
213 cp $< $@
215 $(obj-web)/%.html: %.html.in
216 @mkdir -p $(dir $@)
217 python ../web/texpand.py $< $@
219 %.gz: %
220 gzip -9 -c $< > $@