hgbook

annotate en/Makefile @ 179:5fc4a45c069f

Continue documentation of collaboration models.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri Mar 30 23:05:28 2007 -0700 (2007-03-30)
parents c54f4c106fd5
children 404e7951dd04 b60e2de6dbc3
rev   line source
bos@18 1 # This makefile requires GNU make.
bos@18 2
bos@2 3 sources := \
bos@2 4 00book.tex \
bos@2 5 99book.bib \
bos@2 6 99defs.tex \
bos@34 7 build_id.tex \
bos@132 8 cmdref.tex \
bos@159 9 collab.tex \
bos@59 10 concepts.tex \
bos@42 11 daily.tex \
bos@133 12 filenames.tex \
bos@177 13 hg_id.tex \
bos@34 14 hook.tex \
bos@16 15 intro.tex \
bos@16 16 mq.tex \
bos@104 17 mq-collab.tex \
bos@104 18 mq-ref.tex \
bos@76 19 preface.tex \
bos@85 20 srcinstall.tex \
bos@84 21 template.tex \
bos@95 22 tour-basic.tex \
bos@121 23 tour-merge.tex \
bos@121 24 undo.tex
bos@0 25
bos@11 26 image-sources := \
bos@179 27 feature-branches.dot \
bos@108 28 filelog.svg \
bos@103 29 kdiff3.png \
bos@109 30 metadata.svg \
bos@96 31 mq-stack.svg \
bos@149 32 note.png \
bos@112 33 revlog.svg \
bos@110 34 snapshot.svg \
bos@99 35 tour-history.svg \
bos@103 36 tour-merge-conflict.svg \
bos@103 37 tour-merge-merge.svg \
bos@100 38 tour-merge-pull.svg \
bos@113 39 tour-merge-sep-repos.svg \
bos@124 40 undo-manual.dot \
bos@124 41 undo-manual-merge.dot \
bos@124 42 undo-non-tip.dot \
bos@124 43 undo-simple.dot \
bos@113 44 wdir.svg \
bos@115 45 wdir-after-commit.svg \
bos@115 46 wdir-branch.svg \
bos@115 47 wdir-merge.svg \
bos@115 48 wdir-pre-branch.svg
bos@103 49
bos@124 50 image-dot := $(filter %.dot,$(image-sources))
bos@103 51 image-svg := $(filter %.svg,$(image-sources))
bos@124 52 image-png := $(filter %.png,$(image-sources))
bos@11 53
bos@4 54 example-sources := \
bos@124 55 backout \
bos@131 56 bisect \
bos@179 57 branching \
bos@133 58 cmdref \
bos@117 59 daily.copy \
bos@86 60 daily.files \
bos@118 61 daily.rename \
bos@122 62 daily.revert \
bos@133 63 filenames \
bos@86 64 hook.msglen \
bos@86 65 hook.simple \
bos@86 66 hook.ws \
bos@156 67 issue29 \
bos@104 68 mq.guards \
bos@86 69 mq.qinit-help \
bos@86 70 mq.dodiff \
bos@86 71 mq.id \
bos@86 72 mq.tarball \
bos@86 73 mq.tools \
bos@86 74 mq.tutorial \
bos@156 75 rename.divergent \
bos@121 76 rollback \
bos@86 77 template.simple \
bos@87 78 template.svnstyle \
bos@103 79 tour \
bos@103 80 tour-merge-conflict
bos@4 81
bos@172 82 example-prereqs := \
bos@172 83 /usr/bin/merge
bos@172 84
bos@157 85 dist-sources := \
bos@159 86 ../html/hgicon.png \
bos@157 87 ../html/index.html.var \
bos@157 88 ../html/index.en.html
bos@157 89
bos@0 90 latex-options = \
bos@0 91 -interaction batchmode \
bos@0 92 -output-directory $(dir $(1)) \
bos@0 93 -jobname $(basename $(notdir $(1)))
bos@0 94
bos@177 95 hg = $(shell which hg)
bos@177 96
bos@177 97 hg-id = $(shell hg parents --template '{node|short}\n')
bos@177 98
bos@177 99 hg-version = $(shell hg version -q | \
bos@177 100 sed 's,.*(version \(unknown\|[a-f0-9]*\)),\1,')
bos@177 101
bos@0 102 all: pdf html
bos@0 103
bos@0 104 pdf: pdf/hgbook.pdf
bos@0 105
bos@18 106 define pdf
bos@0 107 mkdir -p $(dir $@)
bos@21 108 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@2 109 cp 99book.bib $(dir $@)
bos@2 110 cd $(dir $@) && bibtex $(basename $(notdir $@))
bos@16 111 cd $(dir $@) && makeindex $(basename $(notdir $@))
bos@21 112 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@21 113 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@26 114 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
bos@18 115 endef
bos@18 116
bos@124 117 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
bos@124 118
bos@124 119 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
bos@18 120 $(call pdf)
bos@0 121
bos@149 122 html: onepage split
bos@149 123
bos@171 124 htlatex := /usr/bin/htlatex
bos@149 125
bos@171 126 onepage: $(htlatex) html/onepage/hgbook.html
bos@171 127
bos@171 128 split: $(htlatex) html/split/hgbook.html
bos@0 129
bos@18 130 # This is a horrible hack to work around the fact that the htlatex
bos@18 131 # command in tex4ht is itself a horrible hack. I really don't want to
bos@18 132 # include verbatim the big wad of TeX that is repeated in that script,
bos@171 133 # but I've given up and run a hacked copy as htlatex.book here.
bos@18 134
bos@0 135 define htlatex
bos@0 136 mkdir -p $(dir $(1))
bos@170 137 cp 99book.bib $(dir $(1))
bos@170 138 TEXINPUTS=$(dir $(2)): ./htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "$(dir $(1))" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
bos@0 139 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
bos@0 140 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
bos@149 141 ./fixhtml.py $(dir $(1))/*.html
bos@0 142 endef
bos@0 143
bos@124 144 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
bos@124 145
bos@149 146 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
bos@0 147 $(call htlatex,$@,$<)
bos@11 148 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@149 149 cp hgbook.css $(dir $@)
bos@0 150
bos@149 151 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
bos@0 152 $(call htlatex,$@,$<,2)
bos@11 153 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@149 154 cp hgbook.css $(dir $@)
bos@18 155
bos@18 156 # Produce 90dpi PNGs for the web.
bos@18 157
bos@11 158 %.png: %.svg
bos@11 159 inkscape -D -e $@ $<
bos@11 160
bos@124 161 %.svg: %.dot
bos@124 162 dot -Tsvg -o $@ $<
bos@124 163
jeffpc@30 164 # Produce eps & pdf for the pdf
bos@18 165
jeffpc@30 166 %.pdf: %.eps
jeffpc@30 167 epstopdf $<
jeffpc@30 168
jeffpc@30 169 %.eps: %.svg
bos@32 170 inkscape -E $@ $<
bos@11 171
bos@124 172 %.eps: %.dot
bos@124 173 dot -Tps -o $@ $<
bos@124 174
bos@172 175 examples: $(example-prereqs) examples/.run
bos@4 176
bos@86 177 examples/.run: $(example-sources:%=examples/%.run)
bos@45 178 touch examples/.run
bos@45 179
bos@45 180 examples/%.run: examples/% examples/run-example
bos@45 181 cd examples && ./run-example $(notdir $<)
bos@4 182
bos@18 183 build_id.tex: $(wildcard ../.hg/00changelog.[id])
bos@177 184 echo -n $(hg-id) > build_id.tex
bos@177 185
bos@177 186 hg_id.tex: $(hg)
bos@177 187 echo -n $(hg-version) > hg_id.tex
bos@16 188
bos@0 189 clean:
bos@153 190 rm -rf dist html pdf \
bos@124 191 $(image-dot:%.dot=%.pdf) \
bos@124 192 $(image-dot:%.dot=%.png) \
bos@103 193 $(image-svg:%.svg=%.pdf) \
bos@103 194 $(image-svg:%.svg=%.png) \
bos@177 195 examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex
bos@153 196
bos@157 197 install: pdf split $(dist-sources)
bos@153 198 rm -rf dist
bos@153 199 mkdir -p dist
bos@153 200 cp pdf/hgbook.pdf dist
bos@153 201 cp html/split/*.{css,html,png} dist
bos@157 202 cp $(dist-sources) dist
bos@153 203
bos@153 204 rsync: install
bos@153 205 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook