hgbook

view en/Makefile @ 11:e9d5b4c3d16b

First SVG image!
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Jun 29 00:32:35 2006 -0700 (2006-06-29)
parents 339e75288632
children 81454425eee9
line source
1 sources := \
2 00book.tex \
3 99book.bib \
4 99defs.tex \
5 mq.tex
7 image-sources := \
8 mq-stack.svg
10 example-sources := \
11 examples/run-example \
12 examples/mq.qinit-help \
13 examples/mq.tutorial
15 latex-options = \
16 -interaction batchmode \
17 -output-directory $(dir $(1)) \
18 -jobname $(basename $(notdir $(1)))
20 all: pdf html
22 pdf: pdf/hgbook.pdf
24 pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
25 mkdir -p $(dir $@)
26 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
27 cp 99book.bib $(dir $@)
28 cd $(dir $@) && bibtex $(basename $(notdir $@))
29 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
30 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
32 html: html/onepage/hgbook.html html/split/hgbook.html
34 define htlatex
35 mkdir -p $(dir $(1))
36 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
37 cp 99book.bib $(dir $@)
38 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
39 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
40 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
41 chmod 755 $(dir $(1))/htlatex.book
42 $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
43 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
44 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
45 perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
46 endef
48 html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
49 $(call htlatex,$@,$<)
50 cp $(image-sources:%.svg=%.png) $(dir $@)
52 html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
53 $(call htlatex,$@,$<,2)
54 cp $(image-sources:%.svg=%.png) $(dir $@)
56 %.png: %.svg
57 inkscape -D -e $@ $<
59 %_pdf.png: %.svg
60 inkscape -D -d 300 -e $@ $<
62 %.eps: %.svg
63 inkscape -E $@ $<
65 examples: examples/.run
67 examples/.run: $(example-sources)
68 cd examples && ./run-example
70 clean:
71 rm -rf html pdf *.eps *.png *.aux *.dvi *.log *.out examples/*.out examples/.run