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