Mercurial > hgbook
annotate en/Makefile @ 103:5b80c922ebdd
More merge content.
| author | Bryan O'Sullivan <bos@serpentine.com> |
|---|---|
| date | Thu, 19 Oct 2006 15:18:07 -0700 |
| parents | 272146fab009 |
| children | 32bf9a5f22c0 |
| 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 \ |
|
76
df88df78288d
Add template chapter to build.
Bryan O'Sullivan <bos@serpentine.com>
parents:
69
diff
changeset
|
15 preface.tex \ |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
16 srcinstall.tex \ |
| 84 | 17 template.tex \ |
|
95
47ea206351d5
Split tour into two sections.
Bryan O'Sullivan <bos@serpentine.com>
parents:
87
diff
changeset
|
18 tour-basic.tex \ |
|
47ea206351d5
Split tour into two sections.
Bryan O'Sullivan <bos@serpentine.com>
parents:
87
diff
changeset
|
19 tour-merge.tex |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 |
| 11 | 21 image-sources := \ |
| 103 | 22 kdiff3.png \ |
|
96
7d7ddc3a57af
Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents:
95
diff
changeset
|
23 mq-stack.svg \ |
| 99 | 24 tour-history.svg \ |
| 103 | 25 tour-merge-conflict.svg \ |
| 26 tour-merge-merge.svg \ | |
|
100
272146fab009
Add yet another illustration of the merge process.
Bryan O'Sullivan <bos@serpentine.com>
parents:
99
diff
changeset
|
27 tour-merge-pull.svg \ |
| 103 | 28 tour-merge-sep-repos.svg |
| 29 | |
| 30 image-svg := $(filter %.svg,$(image-sources)) | |
| 11 | 31 |
|
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 example-sources := \ |
| 86 | 33 daily.files \ |
| 34 hook.msglen \ | |
| 35 hook.simple \ | |
| 36 hook.ws \ | |
| 37 mq.qinit-help \ | |
| 38 mq.dodiff \ | |
| 39 mq.id \ | |
| 40 mq.tarball \ | |
| 41 mq.tools \ | |
| 42 mq.tutorial \ | |
| 43 template.simple \ | |
| 87 | 44 template.svnstyle \ |
| 103 | 45 tour \ |
| 46 tour-merge-conflict | |
|
4
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
47 |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
48 latex-options = \ |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
49 -interaction batchmode \ |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
50 -output-directory $(dir $(1)) \ |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
51 -jobname $(basename $(notdir $(1))) |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
52 |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
53 all: pdf html |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
54 |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
55 pdf: pdf/hgbook.pdf |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
56 |
|
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
57 define pdf |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 mkdir -p $(dir $@) |
|
21
ce3339dbeb6f
Get beta feedback stuff into better shape.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
59 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
| 2 | 60 cp 99book.bib $(dir $@) |
| 61 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
|
62 cd $(dir $@) && makeindex $(basename $(notdir $@)) |
|
21
ce3339dbeb6f
Get beta feedback stuff into better shape.
Bryan O'Sullivan <bos@serpentine.com>
parents:
18
diff
changeset
|
63 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
|
64 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
| 26 | 65 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
|
66 endef |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
67 |
|
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
68 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
|
69 $(call pdf) |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
70 |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
71 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
|
72 |
|
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
73 # 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
|
74 # 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
|
75 # 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
|
76 # 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
|
77 |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
78 define htlatex |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 mkdir -p $(dir $(1)) |
|
7
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
80 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
|
81 cp 99book.bib $(dir $@) |
|
339e75288632
More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4
diff
changeset
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 endef |
|
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
92 |
| 11 | 93 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
|
94 $(call htlatex,$@,$<) |
| 11 | 95 cp $(image-sources:%.svg=%.png) $(dir $@) |
| 96 | |
| 97 html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples | |
| 98 $(call htlatex,$@,$<,2) | |
| 99 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
|
100 |
|
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
101 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
|
102 |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
103 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
|
104 ./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
|
105 |
|
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
106 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
|
107 $(call pdf) |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
108 |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
109 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
|
110 $(call htlatex,$@,$<) |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
111 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
|
112 |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
113 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
|
114 $(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
|
115 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
|
116 |
|
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
117 # 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
|
118 |
| 11 | 119 %.png: %.svg |
| 120 inkscape -D -e $@ $< | |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
121 |
|
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
122 # 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
|
123 |
|
30
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
124 %.pdf: %.eps |
|
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
125 epstopdf $< |
|
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
126 |
|
cc1e6f1d7161
Use PDF instead of PNG for images in the PDF book
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
26
diff
changeset
|
127 %.eps: %.svg |
|
32
b7d46e86a5f1
Stop inkscape from printing an annoying message.
Bryan O'Sullivan <bos@serpentine.com>
parents:
31
diff
changeset
|
128 inkscape -E $@ $< |
| 11 | 129 |
|
4
33a2e7b9978d
Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2
diff
changeset
|
130 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
|
131 |
| 86 | 132 examples/.run: $(example-sources:%=examples/%.run) |
|
45
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
133 touch examples/.run |
|
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
134 |
|
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
135 examples/%.run: examples/% examples/run-example |
|
6b7b0339e7d6
Don't rerun examples unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
44
diff
changeset
|
136 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
|
137 |
|
18
e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents:
16
diff
changeset
|
138 build_id.tex: $(wildcard ../.hg/00changelog.[id]) |
|
29
6e988159394b
Add revision ID to output.
Bryan O'Sullivan <bos@serpentine.com>
parents:
26
diff
changeset
|
139 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
|
140 |
|
0
76fba5835a1b
Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
141 clean: |
| 103 | 142 rm -rf beta html pdf \ |
| 143 $(image-svg:%.svg=%.pdf) \ | |
| 144 $(image-svg:%.svg=%.png) \ | |
|
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
|
145 examples/*.{out,run} examples/.run build_id.tex |
