hgbook

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