hgbook

annotate en/Makefile @ 134:b727a63518d4

Minor updates to race description.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri Jul 21 22:42:19 2006 -0700 (2006-07-21)
parents b7d46e86a5f1
children cbfa08bcf181 b8539d91c84d
rev   line source
bos@18 1 # This makefile requires GNU make.
bos@18 2
bos@29 3 hg_id := $(shell hg parents --template '{node|short}\n' | head -1)
bos@18 4
bos@2 5 sources := \
bos@2 6 00book.tex \
bos@2 7 99book.bib \
bos@2 8 99defs.tex \
bos@34 9 build_id.tex \
bos@34 10 hook.tex \
bos@16 11 intro.tex \
bos@16 12 mq.tex \
bos@34 13 preface.tex
bos@0 14
bos@11 15 image-sources := \
bos@11 16 mq-stack.svg
bos@11 17
bos@4 18 example-sources := \
bos@4 19 examples/run-example \
bos@34 20 examples/hook.simple \
bos@7 21 examples/mq.qinit-help \
bos@19 22 examples/mq.diff \
bos@19 23 examples/mq.tarball \
bos@19 24 examples/mq.tools \
bos@7 25 examples/mq.tutorial
bos@4 26
bos@0 27 latex-options = \
bos@0 28 -interaction batchmode \
bos@0 29 -output-directory $(dir $(1)) \
bos@0 30 -jobname $(basename $(notdir $(1)))
bos@0 31
bos@0 32 all: pdf html
bos@0 33
bos@0 34 pdf: pdf/hgbook.pdf
bos@0 35
bos@18 36 define pdf
bos@0 37 mkdir -p $(dir $@)
bos@21 38 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@2 39 cp 99book.bib $(dir $@)
bos@2 40 cd $(dir $@) && bibtex $(basename $(notdir $@))
bos@16 41 cd $(dir $@) && makeindex $(basename $(notdir $@))
bos@21 42 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@21 43 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@26 44 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
bos@18 45 endef
bos@18 46
jeffpc@30 47 pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%.pdf) examples
bos@18 48 $(call pdf)
bos@0 49
bos@0 50 html: html/onepage/hgbook.html html/split/hgbook.html
bos@0 51
bos@18 52 # This is a horrible hack to work around the fact that the htlatex
bos@18 53 # command in tex4ht is itself a horrible hack. I really don't want to
bos@18 54 # include verbatim the big wad of TeX that is repeated in that script,
bos@18 55 # so instead I mangle the script itself.
bos@18 56
bos@0 57 define htlatex
bos@0 58 mkdir -p $(dir $(1))
bos@7 59 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
bos@7 60 cp 99book.bib $(dir $@)
bos@7 61 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
bos@16 62 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
bos@7 63 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
bos@7 64 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
bos@0 65 chmod 755 $(dir $(1))/htlatex.book
bos@21 66 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
bos@0 67 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
bos@0 68 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
bos@7 69 perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
bos@0 70 endef
bos@0 71
bos@11 72 html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
bos@0 73 $(call htlatex,$@,$<)
bos@11 74 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@0 75
bos@11 76 html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
bos@0 77 $(call htlatex,$@,$<,2)
bos@11 78 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@0 79
bos@18 80 beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
bos@18 81
bos@18 82 beta/%.tex: %.tex
bos@18 83 ./fblinks $(hg_id) $(dir $@) $<
bos@18 84
jeffpc@30 85 beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks
bos@18 86 $(call pdf)
bos@18 87
bos@18 88 beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
bos@18 89 $(call htlatex,$@,$<)
bos@18 90 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@18 91
bos@18 92 beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
bos@18 93 $(call htlatex,$@,$<,2)
bos@18 94 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@18 95
bos@18 96 # Produce 90dpi PNGs for the web.
bos@18 97
bos@11 98 %.png: %.svg
bos@11 99 inkscape -D -e $@ $<
bos@11 100
jeffpc@30 101 # Produce eps & pdf for the pdf
bos@18 102
jeffpc@30 103 %.pdf: %.eps
jeffpc@30 104 epstopdf $<
jeffpc@30 105
jeffpc@30 106 %.eps: %.svg
bos@32 107 inkscape -E $@ $<
bos@11 108
bos@4 109 examples: examples/.run
bos@4 110
bos@4 111 examples/.run: $(example-sources)
bos@4 112 cd examples && ./run-example
bos@4 113
bos@18 114 build_id.tex: $(wildcard ../.hg/00changelog.[id])
bos@29 115 echo -n $(hg_id) > build_id.tex
bos@16 116
bos@0 117 clean:
jeffpc@30 118 rm -rf beta html pdf *.eps *.pdf *.png *.aux *.dvi *.log *.out \
bos@18 119 examples/*.out examples/.run build_id.tex