rev |
line source |
bos@18
|
1 # This makefile requires GNU make.
|
bos@18
|
2
|
bos@595
|
3 image-sources := $(wildcard figs/*.dot figs/*.gif figs/*.png figs/*.svg)
|
bos@103
|
4
|
bos@558
|
5 xml-src-files := \
|
bos@558
|
6 00book.xml \
|
bos@559
|
7 app*.xml \
|
bos@559
|
8 ch*.xml
|
bos@558
|
9
|
bos@124
|
10 image-dot := $(filter %.dot,$(image-sources))
|
bos@103
|
11 image-svg := $(filter %.svg,$(image-sources))
|
bos@595
|
12 image-oth := $(filter %.gif %.png,$(image-sources))
|
bos@11
|
13
|
bos@594
|
14 obj-web := html
|
bos@594
|
15 obj-websup := $(obj-web)/support
|
bos@594
|
16 obj-web-read := $(obj-web)/read
|
bos@594
|
17
|
bos@594
|
18 image-web := \
|
bos@594
|
19 $(image-dot:%.dot=$(obj-web-read)/%.png) \
|
bos@594
|
20 $(image-svg:%.svg=$(obj-web-read)/%.png) \
|
bos@595
|
21 $(image-oth:%=$(obj-web-read)/%)
|
bos@213
|
22
|
bos@580
|
23 example-sources-by-name := \
|
bos@124
|
24 backout \
|
bos@131
|
25 bisect \
|
bos@179
|
26 branching \
|
bos@202
|
27 branch-named \
|
bos@198
|
28 branch-repo \
|
bos@133
|
29 cmdref \
|
bos@117
|
30 daily.copy \
|
bos@86
|
31 daily.files \
|
bos@118
|
32 daily.rename \
|
bos@122
|
33 daily.revert \
|
bos@226
|
34 extdiff \
|
bos@133
|
35 filenames \
|
bos@86
|
36 hook.msglen \
|
bos@86
|
37 hook.simple \
|
bos@156
|
38 issue29 \
|
bos@104
|
39 mq.guards \
|
bos@86
|
40 mq.qinit-help \
|
bos@86
|
41 mq.dodiff \
|
bos@86
|
42 mq.id \
|
bos@86
|
43 mq.tarball \
|
bos@86
|
44 mq.tools \
|
bos@86
|
45 mq.tutorial \
|
bos@156
|
46 rename.divergent \
|
bos@121
|
47 rollback \
|
bos@196
|
48 tag \
|
bos@86
|
49 template.simple \
|
bos@87
|
50 template.svnstyle \
|
bos@103
|
51 tour \
|
bos@103
|
52 tour-merge-conflict
|
bos@4
|
53
|
bos@580
|
54 example-sources := \
|
bos@580
|
55 $(example-sources-by-name:%=examples/%) \
|
bos@580
|
56 $(wildcard examples/ch*/*)
|
bos@580
|
57
|
bos@575
|
58 extras-web-base := \
|
bos@575
|
59 $(obj-web)/index.html \
|
bos@575
|
60 $(obj-web)/robots.txt \
|
bos@575
|
61 $(obj-websup)/form-min.js \
|
bos@575
|
62 $(obj-websup)/form.js \
|
bos@575
|
63 $(obj-websup)/hsbook.js \
|
bos@575
|
64 $(obj-websup)/jquery-min.js \
|
bos@575
|
65 $(obj-websup)/jquery.js \
|
bos@575
|
66 $(obj-websup)/styles.css
|
bos@575
|
67
|
bos@575
|
68 extras-web := $(extras-web-base) $(extras-web-base:%=%.gz)
|
bos@575
|
69
|
bos@558
|
70 xsltproc := xsltproc
|
bos@558
|
71 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
|
bos@558
|
72
|
bos@558
|
73 xmllint := xmllint
|
bos@558
|
74 xmllint-opts := --noout --nonet --valid
|
bos@558
|
75
|
bos@558
|
76 system-xsl-dir := $(firstword $(wildcard \
|
bos@558
|
77 /usr/share/sgml/docbook/xsl-stylesheets \
|
bos@558
|
78 /usr/share/xml/docbook/stylesheet/nwalsh \
|
bos@558
|
79 ))
|
bos@558
|
80
|
bos@558
|
81 # Bletcherousness.
|
bos@558
|
82
|
bos@558
|
83 ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),)
|
bos@558
|
84 dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*)
|
bos@558
|
85 else
|
bos@558
|
86 ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),)
|
bos@558
|
87 dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4)
|
bos@558
|
88 else
|
bos@558
|
89 $(error Do not know where to look for DocBook XML 4.4 DTD)
|
bos@558
|
90 endif
|
bos@558
|
91 endif
|
bos@558
|
92
|
bos@558
|
93 ifeq ($(system-xsl-dir),)
|
bos@558
|
94 $(error add a suitable directory to system-xsl-dir)
|
bos@558
|
95 endif
|
bos@558
|
96
|
bos@172
|
97 example-prereqs := \
|
bos@172
|
98 /usr/bin/merge
|
bos@172
|
99
|
bos@157
|
100 dist-sources := \
|
bos@159
|
101 ../html/hgicon.png \
|
bos@157
|
102 ../html/index.html.var \
|
bos@157
|
103 ../html/index.en.html
|
bos@157
|
104
|
bos@177
|
105 hg = $(shell which hg)
|
bos@177
|
106
|
bos@269
|
107 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n')
|
bos@177
|
108
|
bos@177
|
109 hg-version = $(shell hg version -q | \
|
bos@242
|
110 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
|
bos@177
|
111
|
bos@613
|
112 all: web complete.xml
|
bos@149
|
113
|
dongsheng@654
|
114 ../stylesheets/system-xsl: $(system-xsl-dir)
|
bos@558
|
115 ln -s $< $@
|
bos@558
|
116
|
dongsheng@654
|
117 web: ../stylesheets/system-xsl websup html
|
bos@575
|
118
|
bos@594
|
119 html: $(obj-web-read)/index.html
|
bos@594
|
120
|
bos@599
|
121 ../web/index-read.html.in: ../web/genindex.py $(xml-src-files)
|
bos@614
|
122 cd ../web && ./genindex.py
|
bos@599
|
123
|
dongsheng@654
|
124 $(obj-web-read)/index.html: ../stylesheets/system-xsl .validated-00book.xml ../web/index-read.html.in
|
dongsheng@654
|
125 xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../stylesheets/chunk-stylesheet.xsl 00book.xml
|
bos@599
|
126 python ../web/texpand.py ../web/index-read.html.in html/read/index.html
|
bos@594
|
127 for i in $(obj-web-read)/*.html; do \
|
bos@575
|
128 gzip -9 -c $$i > $$i.gz; \
|
bos@575
|
129 done
|
bos@575
|
130
|
bos@594
|
131 websup: $(extras-web) $(image-web)
|
bos@594
|
132 mkdir -p $(obj-websup)/figs $(obj-web-read)/figs
|
dongsheng@654
|
133 cp ../stylesheets/system-xsl/images/*.png $(obj-websup)/figs
|
bos@575
|
134 cp -f ../web/icons/*.png $(obj-websup)/figs
|
bos@575
|
135
|
bos@613
|
136 complete.xml: .validated-00book.xml
|
songdongsheng@667
|
137 $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/dtd-profile.xsl 00book.xml
|
songdongsheng@667
|
138
|
dongsheng@654
|
139 all-ids.dat: ../stylesheets/all-ids.xsl $(xml-src-files)
|
dongsheng@654
|
140 $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/all-ids.xsl 00book.xml
|
bos@588
|
141
|
bos@575
|
142 web: websup
|
bos@558
|
143
|
bos@558
|
144 valid: .validated-00book.xml
|
bos@558
|
145
|
bos@614
|
146 .validated-00book.xml: $(xml-src-files) examples/.run
|
bos@558
|
147 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
|
bos@558
|
148 touch $@
|
bos@558
|
149
|
bos@18
|
150 # Produce 90dpi PNGs for the web.
|
bos@18
|
151
|
bos@594
|
152 $(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg
|
bos@594
|
153 mkdir -p $(dir $@)
|
hg@307
|
154 ./fixsvg $<
|
bos@309
|
155 inkscape -D -e $@ $<-tmp.svg
|
bos@309
|
156 rm $<-tmp.svg
|
bos@11
|
157
|
bos@594
|
158 $(obj-web-read)/figs/%.png: figs/%.svg fixsvg
|
bos@594
|
159 mkdir -p $(dir $@)
|
bos@594
|
160 ./fixsvg $<
|
bos@594
|
161 inkscape -D -e $@ $<-tmp.svg
|
bos@594
|
162 rm $<-tmp.svg
|
bos@594
|
163
|
bos@595
|
164 $(obj-web-read)/figs/%.gif: figs/%.gif
|
bos@595
|
165 cp $< $@
|
bos@595
|
166
|
bos@594
|
167 $(obj-web-read)/figs/%.png: figs/%.png
|
bos@594
|
168 cp $< $@
|
bos@594
|
169
|
bos@594
|
170 $(obj-web-read)/figs/%.svg: figs/%.dot
|
bos@594
|
171 mkdir -p $(dir $@)
|
bos@124
|
172 dot -Tsvg -o $@ $<
|
bos@124
|
173
|
bos@172
|
174 examples: $(example-prereqs) examples/.run
|
bos@4
|
175
|
bos@580
|
176 examples/.run: $(example-sources)
|
bos@615
|
177 cd examples && ./run-example -a
|
bos@45
|
178
|
bos@45
|
179 examples/%.run: examples/% examples/run-example
|
bos@4
|
180
|
bos@571
|
181 clean:
|
bos@571
|
182 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
|
bos@571
|
183 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
|
bos@250
|
184
|
bos@571
|
185 install: html $(dist-sources)
|
bos@153
|
186 rm -rf dist
|
bos@153
|
187 mkdir -p dist
|
bos@571
|
188 cp html/*.{css,html,png} dist
|
bos@157
|
189 cp $(dist-sources) dist
|
bos@153
|
190
|
bos@153
|
191 rsync: install
|
bos@153
|
192 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
|
bos@575
|
193
|
bos@575
|
194 vpath %.css ../web
|
bos@598
|
195 vpath %.html.in ../web
|
bos@575
|
196 vpath %.js ../web/javascript
|
bos@575
|
197
|
bos@575
|
198 $(obj-websup)/%.css: %.css
|
bos@575
|
199 @mkdir -p $(dir $@)
|
bos@575
|
200 cp $< $@
|
bos@575
|
201
|
bos@575
|
202 $(obj-websup)/%.jpg: %.jpg
|
bos@575
|
203 @mkdir -p $(dir $@)
|
bos@575
|
204 cp $< $@
|
bos@575
|
205
|
bos@575
|
206 $(obj-websup)/%.js: %.js
|
bos@575
|
207 @mkdir -p $(dir $@)
|
bos@575
|
208 cp $< $@
|
bos@575
|
209
|
bos@575
|
210 $(obj-web)/%: ../web/%
|
bos@575
|
211 @mkdir -p $(dir $@)
|
bos@575
|
212 cp $< $@
|
bos@575
|
213
|
bos@575
|
214 $(obj-web)/%.html: %.html.in
|
bos@575
|
215 @mkdir -p $(dir $@)
|
bos@575
|
216 python ../web/texpand.py $< $@
|
bos@575
|
217
|
bos@575
|
218 %.gz: %
|
bos@575
|
219 gzip -9 -c $< > $@
|