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