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