hgbook

view en/Makefile @ 151:173e6eac4d5c

Fix "ul" and "dl" lists in HTML.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Mar 08 23:35:23 2007 -0800 (2007-03-08)
parents 65f6f9d18fa1
children cf24633b8de7
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 concepts.tex \
12 daily.tex \
13 filenames.tex \
14 hook.tex \
15 intro.tex \
16 mq.tex \
17 mq-collab.tex \
18 mq-ref.tex \
19 preface.tex \
20 srcinstall.tex \
21 template.tex \
22 tour-basic.tex \
23 tour-merge.tex \
24 undo.tex
26 image-sources := \
27 filelog.svg \
28 kdiff3.png \
29 metadata.svg \
30 mq-stack.svg \
31 note.png \
32 revlog.svg \
33 snapshot.svg \
34 tour-history.svg \
35 tour-merge-conflict.svg \
36 tour-merge-merge.svg \
37 tour-merge-pull.svg \
38 tour-merge-sep-repos.svg \
39 undo-manual.dot \
40 undo-manual-merge.dot \
41 undo-non-tip.dot \
42 undo-simple.dot \
43 wdir.svg \
44 wdir-after-commit.svg \
45 wdir-branch.svg \
46 wdir-merge.svg \
47 wdir-pre-branch.svg
49 image-dot := $(filter %.dot,$(image-sources))
50 image-svg := $(filter %.svg,$(image-sources))
51 image-png := $(filter %.png,$(image-sources))
53 example-sources := \
54 backout \
55 bisect \
56 cmdref \
57 daily.copy \
58 daily.files \
59 daily.rename \
60 daily.revert \
61 filenames \
62 hook.msglen \
63 hook.simple \
64 hook.ws \
65 mq.guards \
66 mq.qinit-help \
67 mq.dodiff \
68 mq.id \
69 mq.tarball \
70 mq.tools \
71 mq.tutorial \
72 rollback \
73 template.simple \
74 template.svnstyle \
75 tour \
76 tour-merge-conflict
78 latex-options = \
79 -interaction batchmode \
80 -output-directory $(dir $(1)) \
81 -jobname $(basename $(notdir $(1)))
83 all: pdf html
85 pdf: pdf/hgbook.pdf
87 define pdf
88 mkdir -p $(dir $@)
89 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
90 cp 99book.bib $(dir $@)
91 cd $(dir $@) && bibtex $(basename $(notdir $@))
92 cd $(dir $@) && makeindex $(basename $(notdir $@))
93 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
94 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
95 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
96 endef
98 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
100 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
101 $(call pdf)
103 html: onepage split
105 onepage: html/onepage/hgbook.html
107 split: html/split/hgbook.html
109 # This is a horrible hack to work around the fact that the htlatex
110 # command in tex4ht is itself a horrible hack. I really don't want to
111 # include verbatim the big wad of TeX that is repeated in that script,
112 # so instead I mangle the script itself.
114 define htlatex
115 mkdir -p $(dir $(1))
116 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
117 cp 99book.bib $(dir $@)
118 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
119 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
120 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
121 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
122 chmod 755 $(dir $(1))/htlatex.book
123 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
124 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
125 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
126 ./fixhtml.py $(dir $(1))/*.html
127 endef
129 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
131 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
132 $(call htlatex,$@,$<)
133 cp $(image-sources:%.svg=%.png) $(dir $@)
134 cp hgbook.css $(dir $@)
136 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
137 $(call htlatex,$@,$<,2)
138 cp $(image-sources:%.svg=%.png) $(dir $@)
139 cp hgbook.css $(dir $@)
141 # Produce 90dpi PNGs for the web.
143 %.png: %.svg
144 inkscape -D -e $@ $<
146 %.svg: %.dot
147 dot -Tsvg -o $@ $<
149 # Produce eps & pdf for the pdf
151 %.pdf: %.eps
152 epstopdf $<
154 %.eps: %.svg
155 inkscape -E $@ $<
157 %.eps: %.dot
158 dot -Tps -o $@ $<
160 examples: examples/.run
162 examples/.run: $(example-sources:%=examples/%.run)
163 touch examples/.run
165 examples/%.run: examples/% examples/run-example
166 cd examples && ./run-example $(notdir $<)
168 build_id.tex: $(wildcard ../.hg/00changelog.[id])
169 echo -n $(hg_id) > build_id.tex
171 clean:
172 rm -rf html pdf \
173 $(image-dot:%.dot=%.pdf) \
174 $(image-dot:%.dot=%.png) \
175 $(image-svg:%.svg=%.pdf) \
176 $(image-svg:%.svg=%.png) \
177 examples/*.{lxo,run} examples/.run build_id.tex