hgbook

view en/Makefile @ 176:edd2acc3dbab

Fix build bogon.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed Mar 28 22:55:13 2007 -0700 (2007-03-28)
parents 8c1703a98266
children c54f4c106fd5
line source
1 # This makefile requires GNU make.
3 hg_id := $(shell hg parents --template '{node|short}\n')
5 sources := \
6 00book.tex \
7 99book.bib \
8 99defs.tex \
9 build_id.tex \
10 cmdref.tex \
11 collab.tex \
12 concepts.tex \
13 daily.tex \
14 filenames.tex \
15 hook.tex \
16 intro.tex \
17 mq.tex \
18 mq-collab.tex \
19 mq-ref.tex \
20 preface.tex \
21 srcinstall.tex \
22 template.tex \
23 tour-basic.tex \
24 tour-merge.tex \
25 undo.tex
27 image-sources := \
28 filelog.svg \
29 kdiff3.png \
30 metadata.svg \
31 mq-stack.svg \
32 note.png \
33 revlog.svg \
34 snapshot.svg \
35 tour-history.svg \
36 tour-merge-conflict.svg \
37 tour-merge-merge.svg \
38 tour-merge-pull.svg \
39 tour-merge-sep-repos.svg \
40 undo-manual.dot \
41 undo-manual-merge.dot \
42 undo-non-tip.dot \
43 undo-simple.dot \
44 wdir.svg \
45 wdir-after-commit.svg \
46 wdir-branch.svg \
47 wdir-merge.svg \
48 wdir-pre-branch.svg
50 image-dot := $(filter %.dot,$(image-sources))
51 image-svg := $(filter %.svg,$(image-sources))
52 image-png := $(filter %.png,$(image-sources))
54 example-sources := \
55 backout \
56 bisect \
57 cmdref \
58 daily.copy \
59 daily.files \
60 daily.rename \
61 daily.revert \
62 filenames \
63 hook.msglen \
64 hook.simple \
65 hook.ws \
66 issue29 \
67 mq.guards \
68 mq.qinit-help \
69 mq.dodiff \
70 mq.id \
71 mq.tarball \
72 mq.tools \
73 mq.tutorial \
74 rename.divergent \
75 rollback \
76 template.simple \
77 template.svnstyle \
78 tour \
79 tour-merge-conflict
81 example-prereqs := \
82 /usr/bin/merge
84 dist-sources := \
85 ../html/hgicon.png \
86 ../html/index.html.var \
87 ../html/index.en.html
89 latex-options = \
90 -interaction batchmode \
91 -output-directory $(dir $(1)) \
92 -jobname $(basename $(notdir $(1)))
94 all: pdf html
96 pdf: pdf/hgbook.pdf
98 define pdf
99 mkdir -p $(dir $@)
100 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
101 cp 99book.bib $(dir $@)
102 cd $(dir $@) && bibtex $(basename $(notdir $@))
103 cd $(dir $@) && makeindex $(basename $(notdir $@))
104 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
105 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
106 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
107 endef
109 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
111 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
112 $(call pdf)
114 html: onepage split
116 htlatex := /usr/bin/htlatex
118 onepage: $(htlatex) html/onepage/hgbook.html
120 split: $(htlatex) html/split/hgbook.html
122 # This is a horrible hack to work around the fact that the htlatex
123 # command in tex4ht is itself a horrible hack. I really don't want to
124 # include verbatim the big wad of TeX that is repeated in that script,
125 # but I've given up and run a hacked copy as htlatex.book here.
127 define htlatex
128 mkdir -p $(dir $(1))
129 cp 99book.bib $(dir $(1))
130 TEXINPUTS=$(dir $(2)): ./htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "$(dir $(1))" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
131 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
132 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
133 ./fixhtml.py $(dir $(1))/*.html
134 endef
136 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
138 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
139 $(call htlatex,$@,$<)
140 cp $(image-sources:%.svg=%.png) $(dir $@)
141 cp hgbook.css $(dir $@)
143 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
144 $(call htlatex,$@,$<,2)
145 cp $(image-sources:%.svg=%.png) $(dir $@)
146 cp hgbook.css $(dir $@)
148 # Produce 90dpi PNGs for the web.
150 %.png: %.svg
151 inkscape -D -e $@ $<
153 %.svg: %.dot
154 dot -Tsvg -o $@ $<
156 # Produce eps & pdf for the pdf
158 %.pdf: %.eps
159 epstopdf $<
161 %.eps: %.svg
162 inkscape -E $@ $<
164 %.eps: %.dot
165 dot -Tps -o $@ $<
167 examples: $(example-prereqs) examples/.run
169 examples/.run: $(example-sources:%=examples/%.run)
170 touch examples/.run
172 examples/%.run: examples/% examples/run-example
173 cd examples && ./run-example $(notdir $<)
175 build_id.tex: $(wildcard ../.hg/00changelog.[id])
176 echo -n $(hg_id) > build_id.tex
178 clean:
179 rm -rf dist html pdf \
180 $(image-dot:%.dot=%.pdf) \
181 $(image-dot:%.dot=%.png) \
182 $(image-svg:%.svg=%.pdf) \
183 $(image-svg:%.svg=%.png) \
184 examples/*.{lxo,run} examples/.run build_id.tex
186 install: pdf split $(dist-sources)
187 rm -rf dist
188 mkdir -p dist
189 cp pdf/hgbook.pdf dist
190 cp html/split/*.{css,html,png} dist
191 cp $(dist-sources) dist
193 rsync: install
194 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook