Mercurial > hgbook
annotate en/Makefile @ 69:e9dd634ab99e
hg_id is a one-liner. Pipe to head is superfluous
author | Guy Brand <gb@isis.u-strasbg.fr> |
---|---|
date | Tue, 08 Aug 2006 20:41:37 +0200 |
parents | 0aae9d676e0f |
children | df88df78288d |
rev | line source |
---|---|
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
1 # This makefile requires GNU make. |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
2 |
69
e9dd634ab99e
hg_id is a one-liner. Pipe to head is superfluous
Guy Brand <gb@isis.u-strasbg.fr>
parents:
59
diff
changeset
|
3 hg_id := $(shell hg parents --template '{node|short}\n') |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
4 |
2 | 5 sources := \ |
6 00book.tex \ | |
7 99book.bib \ | |
8 99defs.tex \ | |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
32
diff
changeset
|
9 build_id.tex \ |
59 | 10 concepts.tex \ |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
34
diff
changeset
|
11 daily.tex \ |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
32
diff
changeset
|
12 hook.tex \ |
16
81454425eee9
Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents:
11
diff
changeset
|
13 intro.tex \ |
81454425eee9
Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents:
11
diff
changeset
|
14 mq.tex \ |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
32
diff
changeset
|
15 preface.tex |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 |
11 | 17 image-sources := \ |
18 mq-stack.svg | |
19 | |
4
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
20 example-sources := \ |
43 | 21 examples/daily.files \ |
49 | 22 examples/hook.msglen \ |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
32
diff
changeset
|
23 examples/hook.simple \ |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
24 examples/hook.ws \ |
59 | 25 examples/concepts \ |
7
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
26 examples/mq.qinit-help \ |
46
dd657c4d3a47
Rename mq.diff to mq.dodiff Emacs won't screw up the syntax highlighting.
Bryan O'Sullivan <bos@serpentine.com>
parents:
45
diff
changeset
|
27 examples/mq.dodiff \ |
50
8b0d389cf6e0
Update MQ chapter to match recent bug fixes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
49
diff
changeset
|
28 examples/mq.id \ |
19
187702df428b
Piles of new content for MQ chapter - cookbook stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
29 examples/mq.tarball \ |
187702df428b
Piles of new content for MQ chapter - cookbook stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
30 examples/mq.tools \ |
7
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
31 examples/mq.tutorial |
4
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
32 |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
33 latex-options = \ |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
34 -interaction batchmode \ |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
35 -output-directory $(dir $(1)) \ |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
36 -jobname $(basename $(notdir $(1))) |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
37 |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
38 all: pdf html |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
39 |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
40 pdf: pdf/hgbook.pdf |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
41 |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
42 define pdf |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
43 mkdir -p $(dir $@) |
21
ce3339dbeb6f
Get beta feedback stuff into better shape.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
44 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
2 | 45 cp 99book.bib $(dir $@) |
46 cd $(dir $@) && bibtex $(basename $(notdir $@)) | |
16
81454425eee9
Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents:
11
diff
changeset
|
47 cd $(dir $@) && makeindex $(basename $(notdir $@)) |
21
ce3339dbeb6f
Get beta feedback stuff into better shape.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
48 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
ce3339dbeb6f
Get beta feedback stuff into better shape.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
49 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
26 | 50 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
51 endef |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
52 |
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
53 pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%.pdf) examples |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
54 $(call pdf) |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
55 |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
56 html: html/onepage/hgbook.html html/split/hgbook.html |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
57 |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
58 # This is a horrible hack to work around the fact that the htlatex |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
59 # command in tex4ht is itself a horrible hack. I really don't want to |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
60 # include verbatim the big wad of TeX that is repeated in that script, |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
61 # so instead I mangle the script itself. |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
62 |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
63 define htlatex |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
64 mkdir -p $(dir $(1)) |
7
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
65 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book |
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
66 cp 99book.bib $(dir $@) |
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
67 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book |
16
81454425eee9
Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents:
11
diff
changeset
|
68 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book |
7
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
69 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book |
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
70 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
71 chmod 755 $(dir $(1))/htlatex.book |
21
ce3339dbeb6f
Get beta feedback stuff into better shape.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
72 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) |
7
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
75 perl -pi -e 's/�([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
76 endef |
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
77 |
11 | 78 html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 $(call htlatex,$@,$<) |
11 | 80 cp $(image-sources:%.svg=%.png) $(dir $@) |
81 | |
82 html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples | |
83 $(call htlatex,$@,$<,2) | |
84 cp $(image-sources:%.svg=%.png) $(dir $@) | |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
85 |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
86 beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
87 |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
88 beta/%.tex: %.tex |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
89 ./fblinks $(hg_id) $(dir $@) $< |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
90 |
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
91 beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
92 $(call pdf) |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
93 |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
94 beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
95 $(call htlatex,$@,$<) |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
96 cp $(image-sources:%.svg=%.png) $(dir $@) |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
97 |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
98 beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
99 $(call htlatex,$@,$<,2) |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
100 cp $(image-sources:%.svg=%.png) $(dir $@) |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
101 |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
102 # Produce 90dpi PNGs for the web. |
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
103 |
11 | 104 %.png: %.svg |
105 inkscape -D -e $@ $< | |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
106 |
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
107 # Produce eps & pdf for the pdf |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
108 |
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
109 %.pdf: %.eps |
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
110 epstopdf $< |
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
111 |
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
112 %.eps: %.svg |
32
b7d46e86a5f1
Stop inkscape from printing an annoying message.
Bryan O'Sullivan <bos@serpentine.com>
parents:
31
diff
changeset
|
113 inkscape -E $@ $< |
11 | 114 |
4
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
115 examples: examples/.run |
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
116 |
45
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
117 examples/.run: $(example-sources:%=%.run) |
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
118 touch examples/.run |
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
119 |
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
120 examples/%.run: examples/% examples/run-example |
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
121 cd examples && ./run-example $(notdir $<) |
4
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
122 |
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
123 build_id.tex: $(wildcard ../.hg/00changelog.[id]) |
29
6e988159394b
Add revision ID to output.
Bryan O'Sullivan <bos@serpentine.com>
parents:
26
diff
changeset
|
124 echo -n $(hg_id) > build_id.tex |
16
81454425eee9
Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents:
11
diff
changeset
|
125 |
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
126 clean: |
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
127 rm -rf beta html pdf *.eps *.pdf *.png *.aux *.dvi *.log *.out \ |
46
dd657c4d3a47
Rename mq.diff to mq.dodiff Emacs won't screw up the syntax highlighting.
Bryan O'Sullivan <bos@serpentine.com>
parents:
45
diff
changeset
|
128 examples/*.{out,run} examples/.run build_id.tex |