hgbook

view en/Makefile @ 16:81454425eee9

Progress on a few fronts, mainly indexing and MQ chapter content
author Bryan O'Sullivan <bos@serpentine.com>
date Mon Jul 03 22:43:52 2006 -0700 (2006-07-03)
parents e9d5b4c3d16b
children e6f4088ebe52
line source
1 sources := \
2 00book.tex \
3 99book.bib \
4 99defs.tex \
5 intro.tex \
6 mq.tex \
7 build_id.tex
9 image-sources := \
10 mq-stack.svg
12 example-sources := \
13 examples/run-example \
14 examples/mq.qinit-help \
15 examples/mq.tutorial
17 latex-options = \
18 -interaction batchmode \
19 -output-directory $(dir $(1)) \
20 -jobname $(basename $(notdir $(1)))
22 all: pdf html
24 pdf: pdf/hgbook.pdf
26 pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
27 mkdir -p $(dir $@)
28 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
29 cp 99book.bib $(dir $@)
30 cd $(dir $@) && bibtex $(basename $(notdir $@))
31 cd $(dir $@) && makeindex $(basename $(notdir $@))
32 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
33 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
35 html: html/onepage/hgbook.html html/split/hgbook.html
37 define htlatex
38 mkdir -p $(dir $(1))
39 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
40 cp 99book.bib $(dir $@)
41 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
42 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
43 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
44 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
45 chmod 755 $(dir $(1))/htlatex.book
46 $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
47 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
48 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
49 perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
50 endef
52 html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
53 $(call htlatex,$@,$<)
54 cp $(image-sources:%.svg=%.png) $(dir $@)
56 html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
57 $(call htlatex,$@,$<,2)
58 cp $(image-sources:%.svg=%.png) $(dir $@)
60 %.png: %.svg
61 inkscape -D -e $@ $<
63 %_pdf.png: %.svg
64 inkscape -D -d 300 -e $@ $<
66 %.eps: %.svg
67 inkscape -E $@ $<
69 examples: examples/.run
71 examples/.run: $(example-sources)
72 cd examples && ./run-example
74 build_id.tex:
75 echo 'in-place build' > $@
77 build_id:
78 hg id | sed -e 's/ tip\>//' > build_id.tex
80 clean:
81 rm -rf html pdf *.eps *.png *.aux *.dvi *.log *.out examples/*.out examples/.run buildrev.tex