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