Mercurial > hgbook
comparison ja/Makefile.tex @ 777:3274ff6650df
add old Makefile for tex compilation
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 25 Apr 2009 00:02:59 +0900 |
parents | |
children | 4cf1bbfe4d2c |
comparison
equal
deleted
inserted
replaced
776:019040fbf5f5 | 777:3274ff6650df |
---|---|
1 # This makefile requires GNU make. | |
2 | |
3 sources := \ | |
4 00book.tex \ | |
5 99book.bib \ | |
6 99defs.tex \ | |
7 build_id.tex \ | |
8 branch.tex \ | |
9 cmdref.tex \ | |
10 collab.tex \ | |
11 concepts.tex \ | |
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 mq-ref.tex \ | |
21 preface.tex \ | |
22 srcinstall.tex \ | |
23 template.tex \ | |
24 tour-basic.tex \ | |
25 tour-merge.tex \ | |
26 undo.tex | |
27 | |
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 | |
51 | |
52 image-dot := $(filter %.dot,$(image-sources)) | |
53 image-svg := $(filter %.svg,$(image-sources)) | |
54 image-png := $(filter %.png,$(image-sources)) | |
55 | |
56 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png) | |
57 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) | |
58 #image-eps := $(image-dot:%.dot=%.eps) $(image-svg:%.svg=%.eps) $(image-png) | |
59 image-eps := $(image-dot:%.dot=%.eps) $(image-svg:%.svg=%.eps) $(image-png:%.png=%.eps) | |
60 | |
61 example-sources := \ | |
62 backout \ | |
63 bisect \ | |
64 branching \ | |
65 branch-named \ | |
66 branch-repo \ | |
67 cmdref \ | |
68 daily.copy \ | |
69 daily.files \ | |
70 daily.rename \ | |
71 daily.revert \ | |
72 extdiff \ | |
73 filenames \ | |
74 hook.msglen \ | |
75 hook.simple \ | |
76 hook.ws \ | |
77 issue29 \ | |
78 mq.guards \ | |
79 mq.qinit-help \ | |
80 mq.dodiff \ | |
81 mq.id \ | |
82 mq.tarball \ | |
83 mq.tools \ | |
84 mq.tutorial \ | |
85 rename.divergent \ | |
86 rollback \ | |
87 tag \ | |
88 template.simple \ | |
89 template.svnstyle \ | |
90 tour \ | |
91 tour-merge-conflict | |
92 | |
93 example-prereqs := \ | |
94 /usr/bin/merge | |
95 | |
96 dist-sources := \ | |
97 ../html/hgicon.png \ | |
98 ../html/index.html.var \ | |
99 ../html/index.en.html | |
100 | |
101 latex-options = \ | |
102 -interaction batchmode \ | |
103 -output-directory $(dir $(1)) \ | |
104 -jobname $(basename $(notdir $(1))) | |
105 | |
106 hg = $(shell which hg) | |
107 | |
108 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n') | |
109 | |
110 hg-version = $(shell hg version -q | \ | |
111 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,') | |
112 | |
113 all: dvi | |
114 | |
115 #dvi: $(sources) $(image-eps) examples | |
116 dvi: $(sources) $(image-eps) | |
117 platex 00book.tex | |
118 | |
119 cp 00book.aux hgbook.aux | |
120 bibtex hgbook | |
121 | |
122 platex 00book.tex | |
123 platex 00book.tex | |
124 platex 00book.tex | |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 pdf: pdf/hgbook.pdf | |
132 | |
133 define pdf | |
134 mkdir -p $(dir $@) | |
135 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) | |
136 | |
137 cp 99book.bib $(dir $@) | |
138 | |
139 cd $(dir $@) && bibtex $(basename $(notdir $@)) | |
140 cd $(dir $@) && makeindex $(basename $(notdir $@)) | |
141 | |
142 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) | |
143 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) | |
144 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi | |
145 endef | |
146 | |
147 #pdf/hgbook.pdf: $(sources) $(image-pdf) examples | |
148 pdf/hgbook.pdf: $(sources) $(image-pdf) | |
149 $(call pdf) | |
150 | |
151 html: onepage split | |
152 | |
153 onepage: $(htlatex) html/onepage/hgbook.html html/onepage/hgbook.css $(image-html:%=html/onepage/%) | |
154 | |
155 html/onepage/%: % | |
156 cp $< $@ | |
157 | |
158 split: $(htlatex) html/split/hgbook.html html/split/hgbook.css $(image-html:%=html/split/%) | |
159 | |
160 html/split/%: % | |
161 cp $< $@ | |
162 | |
163 # This is a horrible hack to work around the fact that the htlatex | |
164 # command in tex4ht is itself a horrible hack. I really don't want to | |
165 # include verbatim the big wad of TeX that is repeated in that script, | |
166 # but I've given up and run a hacked copy as htlatex.book here. | |
167 | |
168 define htlatex | |
169 mkdir -p $(dir $(1)) | |
170 cp 99book.bib $(dir $(1)) | |
171 TEXINPUTS=$(dir $(2)): ./htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "$(dir $(1))" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) | |
172 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf | |
173 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) | |
174 ./fixhtml.py $(dir $(1))/*.html | |
175 rm $(dir $(1))/hgbook.css | |
176 endef | |
177 | |
178 #html/onepage/hgbook.html: $(sources) $(image-html) examples bookhtml.cfg | |
179 html/onepage/hgbook.html: $(sources) $(image-html) bookhtml.cfg | |
180 $(call htlatex,$@,$<) | |
181 | |
182 #html/split/hgbook.html: $(sources) examples bookhtml.cfg | |
183 html/split/hgbook.html: $(sources) bookhtml.cfg | |
184 $(call htlatex,$@,$<,2) | |
185 | |
186 # Produce 90dpi PNGs for the web. | |
187 | |
188 %.png: %.svg | |
189 inkscape -D -e $@ $< | |
190 | |
191 %.svg: %.dot | |
192 dot -Tsvg -o $@ $< | |
193 | |
194 # Produce eps & pdf for the pdf | |
195 | |
196 %.pdf: %.eps | |
197 epstopdf $< | |
198 | |
199 %.eps: %.svg | |
200 inkscape -E $@ $< | |
201 | |
202 %.eps: %.dot | |
203 dot -Tps -o $@ $< | |
204 | |
205 %.eps: %.png | |
206 convert $< ps:$@ | |
207 | |
208 examples: $(example-prereqs) examples/.run | |
209 | |
210 examples/.run: $(example-sources:%=examples/%.run) | |
211 touch examples/.run | |
212 | |
213 examples/%.run: examples/% examples/run-example | |
214 cd examples && ./run-example $(notdir $<) | |
215 | |
216 changelog := $(wildcard ../.hg/store/00changelog.[id]) | |
217 ifeq ($(changelog),) | |
218 changelog := $(wildcard ../.hg/00changelog.[id]) | |
219 endif | |
220 | |
221 build_id.tex: $(changelog) | |
222 echo -n '$(hg-id)' > build_id.tex | |
223 | |
224 hg_id.tex: $(hg) | |
225 echo -n '$(hg-version)' > hg_id.tex | |
226 | |
227 clean: | |
228 rm -rf dist html pdf \ | |
229 $(image-dot:%.dot=%.pdf) \ | |
230 $(image-dot:%.dot=%.png) \ | |
231 $(image-svg:%.svg=%.pdf) \ | |
232 $(image-svg:%.svg=%.png) \ | |
233 examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex | |
234 | |
235 install: pdf split $(dist-sources) | |
236 rm -rf dist | |
237 mkdir -p dist | |
238 cp pdf/hgbook.pdf dist | |
239 cp html/split/*.{css,html,png} dist | |
240 cp $(dist-sources) dist | |
241 |