hgbook

view en/Makefile @ 157:e49f4451d0e3

Add hgbook front page material.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed Mar 21 23:27:34 2007 -0700 (2007-03-21)
parents 91a936be78b8
children 7355af913937
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 issue29 \
66 mq.guards \
67 mq.qinit-help \
68 mq.dodiff \
69 mq.id \
70 mq.tarball \
71 mq.tools \
72 mq.tutorial \
73 rename.divergent \
74 rollback \
75 template.simple \
76 template.svnstyle \
77 tour \
78 tour-merge-conflict
80 dist-sources := \
81 ../html/index.html.var \
82 ../html/index.en.html
84 latex-options = \
85 -interaction batchmode \
86 -output-directory $(dir $(1)) \
87 -jobname $(basename $(notdir $(1)))
89 all: pdf html
91 pdf: pdf/hgbook.pdf
93 define pdf
94 mkdir -p $(dir $@)
95 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
96 cp 99book.bib $(dir $@)
97 cd $(dir $@) && bibtex $(basename $(notdir $@))
98 cd $(dir $@) && makeindex $(basename $(notdir $@))
99 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
100 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
101 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
102 endef
104 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
106 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
107 $(call pdf)
109 html: onepage split
111 onepage: html/onepage/hgbook.html
113 split: html/split/hgbook.html
115 # This is a horrible hack to work around the fact that the htlatex
116 # command in tex4ht is itself a horrible hack. I really don't want to
117 # include verbatim the big wad of TeX that is repeated in that script,
118 # so instead I mangle the script itself.
120 define htlatex
121 mkdir -p $(dir $(1))
122 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
123 cp 99book.bib $(dir $@)
124 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
125 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
126 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
127 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
128 chmod 755 $(dir $(1))/htlatex.book
129 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
130 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
131 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
132 ./fixhtml.py $(dir $(1))/*.html
133 endef
135 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
137 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
138 $(call htlatex,$@,$<)
139 cp $(image-sources:%.svg=%.png) $(dir $@)
140 cp hgbook.css $(dir $@)
142 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
143 $(call htlatex,$@,$<,2)
144 cp $(image-sources:%.svg=%.png) $(dir $@)
145 cp hgbook.css $(dir $@)
147 # Produce 90dpi PNGs for the web.
149 %.png: %.svg
150 inkscape -D -e $@ $<
152 %.svg: %.dot
153 dot -Tsvg -o $@ $<
155 # Produce eps & pdf for the pdf
157 %.pdf: %.eps
158 epstopdf $<
160 %.eps: %.svg
161 inkscape -E $@ $<
163 %.eps: %.dot
164 dot -Tps -o $@ $<
166 examples: examples/.run
168 examples/.run: $(example-sources:%=examples/%.run)
169 touch examples/.run
171 examples/%.run: examples/% examples/run-example
172 cd examples && ./run-example $(notdir $<)
174 build_id.tex: $(wildcard ../.hg/00changelog.[id])
175 echo -n $(hg_id) > build_id.tex
177 clean:
178 rm -rf dist html pdf \
179 $(image-dot:%.dot=%.pdf) \
180 $(image-dot:%.dot=%.png) \
181 $(image-svg:%.svg=%.pdf) \
182 $(image-svg:%.svg=%.png) \
183 examples/*.{lxo,run} examples/.run build_id.tex
185 install: pdf split $(dist-sources)
186 rm -rf dist
187 mkdir -p dist
188 cp pdf/hgbook.pdf dist
189 cp html/split/*.{css,html,png} dist
190 cp $(dist-sources) dist
192 rsync: install
193 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook