annotate en/Makefile @ 18:e6f4088ebe52

Generate a PDF file with a feedback link on each paragraph.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 04 Jul 2006 16:41:31 -0700
parents 81454425eee9
children 187702df428b ce3339dbeb6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
3 hg_id := $(shell hg id 2>/dev/null | sed -e 's/ tip\>//' -e 's/ /,/g' || echo external)
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
4
2
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 0
diff changeset
5 sources := \
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 0
diff changeset
6 00book.tex \
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 0
diff changeset
7 99book.bib \
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 0
diff changeset
8 99defs.tex \
16
81454425eee9 Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents: 11
diff changeset
9 intro.tex \
81454425eee9 Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents: 11
diff changeset
10 mq.tex \
81454425eee9 Progress on a few fronts, mainly indexing and MQ chapter content
Bryan O'Sullivan <bos@serpentine.com>
parents: 11
diff changeset
11 build_id.tex
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12
11
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
13 image-sources := \
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
14 mq-stack.svg
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
15
4
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
16 example-sources := \
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
17 examples/run-example \
7
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
18 examples/mq.qinit-help \
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
19 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
20
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 latex-options = \
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22 -interaction batchmode \
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 -output-directory $(dir $(1)) \
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
24 -jobname $(basename $(notdir $(1)))
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 all: pdf html
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28 pdf: pdf/hgbook.pdf
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29
18
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
30 define pdf
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31 mkdir -p $(dir $@)
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
2
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 0
diff changeset
33 cp 99book.bib $(dir $@)
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 0
diff changeset
34 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
35 cd $(dir $@) && makeindex $(basename $(notdir $@))
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
18
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
38 endef
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
39
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
40 pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
41 $(call pdf)
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
42
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43 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
44
18
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
45 # 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
46 # 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
47 # 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
48 # 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
49
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50 define htlatex
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
51 mkdir -p $(dir $(1))
7
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
52 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
53 cp 99book.bib $(dir $@)
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
54 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
55 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
56 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
57 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
58 chmod 755 $(dir $(1))/htlatex.book
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
59 $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
60 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
61 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
62 perl -pi -e 's/&#x00([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
63 endef
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64
11
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
65 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
66 $(call htlatex,$@,$<)
11
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
67 cp $(image-sources:%.svg=%.png) $(dir $@)
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
68
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
69 html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
70 $(call htlatex,$@,$<,2)
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
71 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
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 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
74
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
75 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
76 ./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
77
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
78 beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%_pdf.png) examples fblinks
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
79 $(call pdf)
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
80
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
81 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
82 $(call htlatex,$@,$<)
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
83 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
84
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
85 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
86 $(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
87 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
88
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
89 # 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
90
11
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
91 %.png: %.svg
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
92 inkscape -D -e $@ $<
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
93
18
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
94 # Produce 300dpi PNGs for PDF.
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
95
11
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
96 %_pdf.png: %.svg
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
97 inkscape -D -d 300 -e $@ $<
e9d5b4c3d16b First SVG image!
Bryan O'Sullivan <bos@serpentine.com>
parents: 7
diff changeset
98
4
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
99 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
100
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
101 examples/.run: $(example-sources)
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
102 cd examples && ./run-example
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
103
18
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
104 build_id.tex: $(wildcard ../.hg/00changelog.[id])
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
105 echo $(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
106
0
76fba5835a1b Beginnings of a build process and file layout.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
107 clean:
18
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
108 rm -rf beta html pdf *.eps *.png *.aux *.dvi *.log *.out \
e6f4088ebe52 Generate a PDF file with a feedback link on each paragraph.
Bryan O'Sullivan <bos@serpentine.com>
parents: 16
diff changeset
109 examples/*.out examples/.run build_id.tex