hgbook

view en/Makefile @ 588:188efaefe001

How to make all-ids.dat.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Mar 19 22:45:02 2009 -0700 (2009-03-19)
parents 5bfa0df6aaed
children 0b45854f0b7b
line source
1 # This makefile requires GNU make.
3 image-sources := \
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
27 xml-src-files := \
28 00book.xml \
29 app*.xml \
30 ch*.xml
32 image-dot := $(filter %.dot,$(image-sources))
33 image-svg := $(filter %.svg,$(image-sources))
34 image-png := $(filter %.png,$(image-sources))
36 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
38 example-sources-by-name := \
39 backout \
40 bisect \
41 branching \
42 branch-named \
43 branch-repo \
44 cmdref \
45 daily.copy \
46 daily.files \
47 daily.rename \
48 daily.revert \
49 extdiff \
50 filenames \
51 hook.msglen \
52 hook.simple \
53 hook.ws \
54 issue29 \
55 mq.guards \
56 mq.qinit-help \
57 mq.dodiff \
58 mq.id \
59 mq.tarball \
60 mq.tools \
61 mq.tutorial \
62 rename.divergent \
63 rollback \
64 tag \
65 template.simple \
66 template.svnstyle \
67 tour \
68 tour-merge-conflict
70 example-sources := \
71 $(example-sources-by-name:%=examples/%) \
72 $(wildcard examples/ch*/*)
74 obj-web := html
75 obj-websup := html/support
77 extras-web-base := \
78 $(obj-web)/index.html \
79 $(obj-web)/robots.txt \
80 $(obj-websup)/form-min.js \
81 $(obj-websup)/form.js \
82 $(obj-websup)/hsbook.js \
83 $(obj-websup)/jquery-min.js \
84 $(obj-websup)/jquery.js \
85 $(obj-websup)/styles.css
87 extras-web := $(extras-web-base) $(extras-web-base:%=%.gz)
89 xsltproc := xsltproc
90 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
92 xmllint := xmllint
93 xmllint-opts := --noout --nonet --valid
95 system-xsl-dir := $(firstword $(wildcard \
96 /usr/share/sgml/docbook/xsl-stylesheets \
97 /usr/share/xml/docbook/stylesheet/nwalsh \
98 ))
100 # Bletcherousness.
102 ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),)
103 dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*)
104 else
105 ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),)
106 dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4)
107 else
108 $(error Do not know where to look for DocBook XML 4.4 DTD)
109 endif
110 endif
112 ifeq ($(system-xsl-dir),)
113 $(error add a suitable directory to system-xsl-dir)
114 endif
116 example-prereqs := \
117 /usr/bin/merge
119 dist-sources := \
120 ../html/hgicon.png \
121 ../html/index.html.var \
122 ../html/index.en.html
124 hg = $(shell which hg)
126 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n')
128 hg-version = $(shell hg version -q | \
129 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
131 all: web
133 ../xsl/system-xsl: $(system-xsl-dir)
134 ln -s $< $@
136 web: ../xsl/system-xsl websup html
138 html: ../xsl/system-xsl $(xml-src-files) valid
139 xsltproc $(xsltproc-opts) -o html/read/x ../xsl/chunk-stylesheet.xsl 00book.xml
140 for i in html/read/*.html; do \
141 gzip -9 -c $$i > $$i.gz; \
142 done
144 websup: $(extras-web)
145 mkdir -p $(obj-websup)/figs
146 cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs
147 cp -f ../web/icons/*.png $(obj-websup)/figs
149 all-ids.dat: ../xsl/all-ids.xsl $(xml-src-files)
150 $(xsltproc) $(xsltproc-opts) -o $@ ../xsl/all-ids.xsl 00book.xml
152 web: websup
154 valid: .validated-00book.xml
156 .validated-00book.xml: $(xml-src-files)
157 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
158 touch $@
160 # Produce 90dpi PNGs for the web.
162 %.png: %.svg fixsvg
163 ./fixsvg $<
164 inkscape -D -e $@ $<-tmp.svg
165 rm $<-tmp.svg
167 %.svg: %.dot
168 dot -Tsvg -o $@ $<
170 examples: $(example-prereqs) examples/.run
172 examples/.run: $(example-sources)
173 cd examples && ./run-example
175 examples/%.run: examples/% examples/run-example
177 clean:
178 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
179 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
181 install: html $(dist-sources)
182 rm -rf dist
183 mkdir -p dist
184 cp html/*.{css,html,png} dist
185 cp $(dist-sources) dist
187 rsync: install
188 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
190 vpath %.css ../web
191 vpath %.js ../web/javascript
193 $(obj-websup)/%.css: %.css
194 @mkdir -p $(dir $@)
195 cp $< $@
197 $(obj-websup)/%.jpg: %.jpg
198 @mkdir -p $(dir $@)
199 cp $< $@
201 $(obj-websup)/%.js: %.js
202 @mkdir -p $(dir $@)
203 cp $< $@
205 $(obj-web)/%: ../web/%
206 @mkdir -p $(dir $@)
207 cp $< $@
209 $(obj-web)/%.html: %.html.in
210 @mkdir -p $(dir $@)
211 python ../web/texpand.py $< $@
213 %.gz: %
214 gzip -9 -c $< > $@