hgbook

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