hgbook

annotate en/Makefile @ 132:e1e2f3e0256a

Start command reference, with the diff command.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Dec 28 16:45:56 2006 -0800 (2006-12-28)
parents 153efeaa8f57
children 1e013fbe35f7
rev   line source
bos@18 1 # This makefile requires GNU make.
bos@18 2
gb@69 3 hg_id := $(shell hg parents --template '{node|short}\n')
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@132 10 cmdref.tex \
bos@59 11 concepts.tex \
bos@42 12 daily.tex \
bos@34 13 hook.tex \
bos@16 14 intro.tex \
bos@16 15 mq.tex \
bos@104 16 mq-collab.tex \
bos@104 17 mq-ref.tex \
bos@76 18 preface.tex \
bos@85 19 srcinstall.tex \
bos@84 20 template.tex \
bos@95 21 tour-basic.tex \
bos@121 22 tour-merge.tex \
bos@121 23 undo.tex
bos@0 24
bos@11 25 image-sources := \
bos@108 26 filelog.svg \
bos@103 27 kdiff3.png \
bos@109 28 metadata.svg \
bos@96 29 mq-stack.svg \
bos@112 30 revlog.svg \
bos@110 31 snapshot.svg \
bos@99 32 tour-history.svg \
bos@103 33 tour-merge-conflict.svg \
bos@103 34 tour-merge-merge.svg \
bos@100 35 tour-merge-pull.svg \
bos@113 36 tour-merge-sep-repos.svg \
bos@124 37 undo-manual.dot \
bos@124 38 undo-manual-merge.dot \
bos@124 39 undo-non-tip.dot \
bos@124 40 undo-simple.dot \
bos@113 41 wdir.svg \
bos@115 42 wdir-after-commit.svg \
bos@115 43 wdir-branch.svg \
bos@115 44 wdir-merge.svg \
bos@115 45 wdir-pre-branch.svg
bos@103 46
bos@124 47 image-dot := $(filter %.dot,$(image-sources))
bos@103 48 image-svg := $(filter %.svg,$(image-sources))
bos@124 49 image-png := $(filter %.png,$(image-sources))
bos@11 50
bos@4 51 example-sources := \
bos@124 52 backout \
bos@131 53 bisect \
bos@117 54 daily.copy \
bos@86 55 daily.files \
bos@118 56 daily.rename \
bos@122 57 daily.revert \
bos@86 58 hook.msglen \
bos@86 59 hook.simple \
bos@86 60 hook.ws \
bos@104 61 mq.guards \
bos@86 62 mq.qinit-help \
bos@86 63 mq.dodiff \
bos@86 64 mq.id \
bos@86 65 mq.tarball \
bos@86 66 mq.tools \
bos@86 67 mq.tutorial \
bos@121 68 rollback \
bos@86 69 template.simple \
bos@87 70 template.svnstyle \
bos@103 71 tour \
bos@103 72 tour-merge-conflict
bos@4 73
bos@0 74 latex-options = \
bos@0 75 -interaction batchmode \
bos@0 76 -output-directory $(dir $(1)) \
bos@0 77 -jobname $(basename $(notdir $(1)))
bos@0 78
bos@0 79 all: pdf html
bos@0 80
bos@0 81 pdf: pdf/hgbook.pdf
bos@0 82
bos@18 83 define pdf
bos@0 84 mkdir -p $(dir $@)
bos@21 85 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@2 86 cp 99book.bib $(dir $@)
bos@2 87 cd $(dir $@) && bibtex $(basename $(notdir $@))
bos@16 88 cd $(dir $@) && makeindex $(basename $(notdir $@))
bos@21 89 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@21 90 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@26 91 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
bos@18 92 endef
bos@18 93
bos@124 94 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
bos@124 95
bos@124 96 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
bos@18 97 $(call pdf)
bos@0 98
bos@0 99 html: html/onepage/hgbook.html html/split/hgbook.html
bos@0 100
bos@18 101 # This is a horrible hack to work around the fact that the htlatex
bos@18 102 # command in tex4ht is itself a horrible hack. I really don't want to
bos@18 103 # include verbatim the big wad of TeX that is repeated in that script,
bos@18 104 # so instead I mangle the script itself.
bos@18 105
bos@0 106 define htlatex
bos@0 107 mkdir -p $(dir $(1))
bos@7 108 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
bos@7 109 cp 99book.bib $(dir $@)
bos@7 110 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
bos@16 111 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
bos@7 112 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
bos@7 113 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
bos@0 114 chmod 755 $(dir $(1))/htlatex.book
bos@21 115 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 116 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
bos@0 117 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
bos@7 118 perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
bos@0 119 endef
bos@0 120
bos@124 121 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
bos@124 122
bos@124 123 html/onepage/hgbook.html: $(sources) $(image-html) examples
bos@0 124 $(call htlatex,$@,$<)
bos@11 125 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@0 126
bos@124 127 html/split/hgbook.html: $(sources) $(image-html) examples
bos@0 128 $(call htlatex,$@,$<,2)
bos@11 129 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@0 130
bos@18 131 beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
bos@18 132
bos@18 133 beta/%.tex: %.tex
bos@18 134 ./fblinks $(hg_id) $(dir $@) $<
bos@18 135
jeffpc@30 136 beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks
bos@18 137 $(call pdf)
bos@18 138
bos@18 139 beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
bos@18 140 $(call htlatex,$@,$<)
bos@18 141 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@18 142
bos@18 143 beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
bos@18 144 $(call htlatex,$@,$<,2)
bos@18 145 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@18 146
bos@18 147 # Produce 90dpi PNGs for the web.
bos@18 148
bos@11 149 %.png: %.svg
bos@11 150 inkscape -D -e $@ $<
bos@11 151
bos@124 152 %.svg: %.dot
bos@124 153 dot -Tsvg -o $@ $<
bos@124 154
jeffpc@30 155 # Produce eps & pdf for the pdf
bos@18 156
jeffpc@30 157 %.pdf: %.eps
jeffpc@30 158 epstopdf $<
jeffpc@30 159
jeffpc@30 160 %.eps: %.svg
bos@32 161 inkscape -E $@ $<
bos@11 162
bos@124 163 %.eps: %.dot
bos@124 164 dot -Tps -o $@ $<
bos@124 165
bos@4 166 examples: examples/.run
bos@4 167
bos@86 168 examples/.run: $(example-sources:%=examples/%.run)
bos@45 169 touch examples/.run
bos@45 170
bos@45 171 examples/%.run: examples/% examples/run-example
bos@45 172 cd examples && ./run-example $(notdir $<)
bos@4 173
bos@18 174 build_id.tex: $(wildcard ../.hg/00changelog.[id])
bos@29 175 echo -n $(hg_id) > build_id.tex
bos@16 176
bos@0 177 clean:
bos@103 178 rm -rf beta html pdf \
bos@124 179 $(image-dot:%.dot=%.pdf) \
bos@124 180 $(image-dot:%.dot=%.png) \
bos@103 181 $(image-svg:%.svg=%.pdf) \
bos@103 182 $(image-svg:%.svg=%.png) \
bos@46 183 examples/*.{out,run} examples/.run build_id.tex