hgbook

view ja/Makefile @ 1010:cd06c45e1631

French translation : ch06-collab.xml - about 50% translated
author Frédéric Bouquet <youshe.jaalon@gmail.com>
date Mon Sep 21 00:02:10 2009 +0200 (2009-09-21)
parents
children
line source
1 # This makefile requires GNU make.
3 sources := \
4 00book.tex \
5 99book.bib \
6 99defs.tex \
7 build_id.tex \
8 branch.tex \
9 collab.tex \
10 concepts.tex \
11 custom.sty \
12 daily.tex \
13 filenames.tex \
14 hg_id.tex \
15 hgext.tex \
16 hook.tex \
17 intro.tex \
18 mq.tex \
19 mq-collab.tex \
20 preface.tex \
21 srcinstall.tex \
22 template.tex \
23 tour-basic.tex \
24 tour-merge.tex \
25 undo.tex \
28 image-sources := \
29 feature-branches.dot \
30 filelog.svg \
31 kdiff3.png \
32 metadata.svg \
33 mq-stack.svg \
34 note.png \
35 revlog.svg \
36 snapshot.svg \
37 tour-history.svg \
38 tour-merge-conflict.svg \
39 tour-merge-merge.svg \
40 tour-merge-pull.svg \
41 tour-merge-sep-repos.svg \
42 undo-manual.dot \
43 undo-manual-merge.dot \
44 undo-non-tip.dot \
45 undo-simple.dot \
46 wdir.svg \
47 wdir-after-commit.svg \
48 wdir-branch.svg \
49 wdir-merge.svg \
50 wdir-pre-branch.svg \
53 image-dot := $(filter %.dot,$(image-sources))
54 image-svg := $(filter %.svg,$(image-sources))
55 image-png := $(filter %.png,$(image-sources))
57 image-pdf := \
58 $(image-dot:%.dot=%.pdf) \
59 $(image-svg:%.svg=%.pdf) \
60 $(image-png) \
63 bb-pdf := \
64 $(image-dot:%.dot=%.bb) \
65 $(image-svg:%.svg=%.bb) \
66 $(image-png:%.png=%.bb) \
69 image-html := \
70 $(image-dot:%.dot=%.png) \
71 $(image-svg:%.svg=%.png) \
72 $(image-png) \
75 example-sources := \
76 backout \
77 bisect \
78 branching \
79 branch-named \
80 branch-repo \
81 cmdref \
82 daily.copy \
83 daily.files \
84 daily.rename \
85 daily.revert \
86 extdiff \
87 filenames \
88 hook.msglen \
89 hook.simple \
90 hook.ws \
91 issue29 \
92 mq.guards \
93 mq.qinit-help \
94 mq.dodiff \
95 mq.id \
96 mq.tarball \
97 mq.tools \
98 mq.tutorial \
99 rename.divergent \
100 rollback \
101 tag \
102 template.simple \
103 template.svnstyle \
104 tour \
105 tour-merge-conflict \
108 example-prereqs := \
109 /usr/bin/merge \
112 binary-staffs := \
113 kdiff3.png \
114 note.png \
115 examples/data/netplug-1.2.5.tar.bz2 \
116 examples/data/netplug-1.2.8.tar.bz2 \
119 dist-sources := \
120 ../html/hgicon.png \
121 ../html/index.html.var \
122 ../html/index.en.html \
125 latex-options = \
126 -interaction batchmode \
127 -output-directory $(dir $(1)) \
128 -jobname $(basename $(notdir $(1))) \
130 hg = $(shell which hg)
132 hg-id =
134 hg-version = unknown
136 ########################################
138 SVG2PNG = sh svg2png.sh
140 SVG2EPS = sh svg2eps.sh
142 GS = gs
144 MAKEINDEX= mendex -J -f
146 ########################################
148 all: pdf html
150 pdf: pdf/hgbook.pdf
152 define pdf
153 mkdir -p $(dir $@)
154 platex $(call latex-options,$@) $(1) \
155 || (rm -f $@; exit 1)
156 cp 99book.bib $(dir $@)
157 cd $(dir $@) && jbibtex $(basename $(notdir $@))
158 cd $(dir $@) && $(MAKEINDEX) $(basename $(notdir $@))
159 platex $(call latex-options,$@) $(1) \
160 || (rm -f $@; exit 1)
161 platex $(call latex-options,$@) $(1) \
162 || (rm -f $@; exit 1)
163 export TEXINPUTS=..; cd $(dir $@) && dvipdfmx $(basename $(notdir $@))
164 # if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
165 endef
167 pdf/hgbook.pdf: $(sources) atbegxxx.tex
168 pdf/hgbook.pdf: $(image-pdf)
169 pdf/hgbook.pdf: $(bb-pdf)
170 #pdf/hgbook.pdf: examples
171 pdf/hgbook.pdf: 00book_pdf.tex
172 $(call pdf,00book_pdf.tex)
174 html: onepage split
176 htlatex := htlatex.sh
178 onepage: $(htlatex)
179 onepage: html/onepage/hgbook.html
180 onepage: html/onepage/hgbook.css
181 onepage: $(image-html:%=html/onepage/%)
183 html/onepage/%: %
184 cp $< $@
186 split: $(htlatex)
187 split: html/split/hgbook.html
188 split: html/split/hgbook.css
189 split: $(image-html:%=html/split/%)
191 html/split/%: %
192 cp $< $@
194 # This is a horrible hack to work around the fact that the htlatex
195 # command in tex4ht is itself a horrible hack. I really don't want to
196 # include verbatim the big wad of TeX that is repeated in that script,
197 # but I've given up and run a hacked copy as htlatex.book here.
199 define htlatex
200 mkdir -p $(dir $@)
201 sh ./htlatex.sh \
202 $(1) \
203 "bookhtml,html4-uni,$(2)" \
204 "$(call latex-options,$@)" \
205 || (rm -f $@; exit 1)
206 cp 99book.bib $(dir $@)
207 cd $(dir $@) && jbibtex $(basename $(notdir $@))
208 cd $(dir $@) \
209 && jtex '\def\filename{{hgbook}{idx}{4dx}{ind}} \input idxmake.4ht' \
210 && $(MAKEINDEX) \
211 -o $(basename $(notdir $@)).ind \
212 $(basename $(notdir $@)).4dx
213 sh ./htlatex.sh \
214 $(1) \
215 "bookhtml,html4-uni,$(2)" \
216 "$(call latex-options,$@)" \
217 || (rm -f $@; exit 1)
218 sh ./htlatex.sh \
219 $(1) \
220 "bookhtml,html4-uni,$(2)" \
221 "$(call latex-options,$@)" \
222 || (rm -f $@; exit 1)
223 cd $(dir $@) && tex4ht -f/$(basename $(notdir $@)) -cvalidate -cunihtf
224 cd $(dir $@) && t4ht -f/$(basename $(notdir $@))
225 python ./fixhtml.py $(dir $@)/*.html
226 rm $(dir $@)/hgbook.css
227 endef
229 html/onepage/hgbook.html: $(sources)
230 html/onepage/hgbook.html: $(image-html)
231 #html/onepage/hgbook.html: examples
232 html/onepage/hgbook.html: bookhtml.cfg
233 html/onepage/hgbook.html: 00book_html.tex
234 $(call htlatex,00book_html.tex)
236 html/split/hgbook.html: $(sources)
237 html/split/hgbook.html: $(image-html)
238 #html/split/hgbook.html: examples
239 html/split/hgbook.html: bookhtml.cfg
240 html/split/hgbook.html: 00book_html.tex
241 $(call htlatex,00book_html.tex,2)
243 # Produce 90dpi PNGs for the web.
245 %.png: %.svg
246 $(SVG2PNG) $@ $<
248 %.svg: %.dot
249 dot -Tsvg -o $@ $<
251 # Produce eps/pdf/bb for the pdf
253 %.pdf: %.eps
254 epstopdf $<
256 %.eps: %.svg
257 $(SVG2EPS) $@ $<
259 %.eps: %.dot
260 dot -Tps -o $@ $<
262 %.bb: %.pdf
263 $(GS) -q -sDEVICE=bbox -dAutoRotatePages=/None - -c quit - \
264 < $< > $@ 2>&1
266 %.bb: %.png
267 ebb $<
269 examples: $(example-prereqs) $(binary-staffs) examples/.run
271 examples/.run: $(example-sources:%=examples/%.run)
272 touch examples/.run
274 examples/%.run: examples/% examples/run-example
275 cd examples && python ./run-example $(notdir $<)
277 changelog := $(wildcard ../.hg/store/00changelog.[id])
278 ifeq ($(changelog),)
279 changelog := $(wildcard ../.hg/00changelog.[id])
280 endif
282 build_id.tex: $(changelog)
283 echo -n '$(hg-id)' > build_id.tex
285 hg_id.tex: $(hg)
286 echo -n '$(hg-version)' > hg_id.tex
288 clean:
289 rm -rf dist html pdf \
290 $(image-dot:%.dot=%.pdf) \
291 $(image-dot:%.dot=%.png) \
292 $(image-dot:%.dot=%.bb) \
293 $(image-svg:%.svg=%.pdf) \
294 $(image-svg:%.svg=%.png) \
295 $(image-svg:%.svg=%.bb) \
296 $(image-png:%.png=%.bb) \
297 examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex
298 rm -f atbegxxx.tex
300 install: pdf split $(dist-sources)
301 rm -rf dist
302 mkdir -p dist
303 cp pdf/hgbook.pdf dist
304 cp html/split/*.{css,html,png} dist
305 cp $(dist-sources) dist
307 rsync: install
308 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
310 ##### these targets are needed because mq can not handle binary files
312 kdiff3.png:
313 cp ../en/kdiff3.png .
315 note.png:
316 cp ../en/note.png .
318 examples/data/netplug-1.2.5.tar.bz2:
319 mkdir -p examples/data
320 cp ../en/examples/data/netplug-1.2.5.tar.bz2 examples/data
322 examples/data/netplug-1.2.8.tar.bz2:
323 mkdir -p examples/data
324 cp ../en/examples/data/netplug-1.2.8.tar.bz2 examples/data