hgbook

annotate en/Makefile @ 157:e49f4451d0e3

Add hgbook front page material.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed Mar 21 23:27:34 2007 -0700 (2007-03-21)
parents 91a936be78b8
children 7355af913937
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@133 13 filenames.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@108 27 filelog.svg \
bos@103 28 kdiff3.png \
bos@109 29 metadata.svg \
bos@96 30 mq-stack.svg \
bos@149 31 note.png \
bos@112 32 revlog.svg \
bos@110 33 snapshot.svg \
bos@99 34 tour-history.svg \
bos@103 35 tour-merge-conflict.svg \
bos@103 36 tour-merge-merge.svg \
bos@100 37 tour-merge-pull.svg \
bos@113 38 tour-merge-sep-repos.svg \
bos@124 39 undo-manual.dot \
bos@124 40 undo-manual-merge.dot \
bos@124 41 undo-non-tip.dot \
bos@124 42 undo-simple.dot \
bos@113 43 wdir.svg \
bos@115 44 wdir-after-commit.svg \
bos@115 45 wdir-branch.svg \
bos@115 46 wdir-merge.svg \
bos@115 47 wdir-pre-branch.svg
bos@103 48
bos@124 49 image-dot := $(filter %.dot,$(image-sources))
bos@103 50 image-svg := $(filter %.svg,$(image-sources))
bos@124 51 image-png := $(filter %.png,$(image-sources))
bos@11 52
bos@4 53 example-sources := \
bos@124 54 backout \
bos@131 55 bisect \
bos@133 56 cmdref \
bos@117 57 daily.copy \
bos@86 58 daily.files \
bos@118 59 daily.rename \
bos@122 60 daily.revert \
bos@133 61 filenames \
bos@86 62 hook.msglen \
bos@86 63 hook.simple \
bos@86 64 hook.ws \
bos@156 65 issue29 \
bos@104 66 mq.guards \
bos@86 67 mq.qinit-help \
bos@86 68 mq.dodiff \
bos@86 69 mq.id \
bos@86 70 mq.tarball \
bos@86 71 mq.tools \
bos@86 72 mq.tutorial \
bos@156 73 rename.divergent \
bos@121 74 rollback \
bos@86 75 template.simple \
bos@87 76 template.svnstyle \
bos@103 77 tour \
bos@103 78 tour-merge-conflict
bos@4 79
bos@157 80 dist-sources := \
bos@157 81 ../html/index.html.var \
bos@157 82 ../html/index.en.html
bos@157 83
bos@0 84 latex-options = \
bos@0 85 -interaction batchmode \
bos@0 86 -output-directory $(dir $(1)) \
bos@0 87 -jobname $(basename $(notdir $(1)))
bos@0 88
bos@0 89 all: pdf html
bos@0 90
bos@0 91 pdf: pdf/hgbook.pdf
bos@0 92
bos@18 93 define pdf
bos@0 94 mkdir -p $(dir $@)
bos@21 95 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@2 96 cp 99book.bib $(dir $@)
bos@2 97 cd $(dir $@) && bibtex $(basename $(notdir $@))
bos@16 98 cd $(dir $@) && makeindex $(basename $(notdir $@))
bos@21 99 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@21 100 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
bos@26 101 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
bos@18 102 endef
bos@18 103
bos@124 104 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
bos@124 105
bos@124 106 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
bos@18 107 $(call pdf)
bos@0 108
bos@149 109 html: onepage split
bos@149 110
bos@149 111 onepage: html/onepage/hgbook.html
bos@149 112
bos@149 113 split: html/split/hgbook.html
bos@0 114
bos@18 115 # This is a horrible hack to work around the fact that the htlatex
bos@18 116 # command in tex4ht is itself a horrible hack. I really don't want to
bos@18 117 # include verbatim the big wad of TeX that is repeated in that script,
bos@18 118 # so instead I mangle the script itself.
bos@18 119
bos@0 120 define htlatex
bos@0 121 mkdir -p $(dir $(1))
bos@7 122 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
bos@7 123 cp 99book.bib $(dir $@)
bos@7 124 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
bos@16 125 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
bos@7 126 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
bos@7 127 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
bos@0 128 chmod 755 $(dir $(1))/htlatex.book
bos@149 129 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
bos@0 130 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
bos@0 131 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
bos@149 132 ./fixhtml.py $(dir $(1))/*.html
bos@0 133 endef
bos@0 134
bos@124 135 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
bos@124 136
bos@149 137 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
bos@0 138 $(call htlatex,$@,$<)
bos@11 139 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@149 140 cp hgbook.css $(dir $@)
bos@0 141
bos@149 142 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
bos@0 143 $(call htlatex,$@,$<,2)
bos@11 144 cp $(image-sources:%.svg=%.png) $(dir $@)
bos@149 145 cp hgbook.css $(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@153 178 rm -rf dist 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@146 183 examples/*.{lxo,run} examples/.run build_id.tex
bos@153 184
bos@157 185 install: pdf split $(dist-sources)
bos@153 186 rm -rf dist
bos@153 187 mkdir -p dist
bos@153 188 cp pdf/hgbook.pdf dist
bos@153 189 cp html/split/*.{css,html,png} dist
bos@157 190 cp $(dist-sources) dist
bos@153 191
bos@153 192 rsync: install
bos@153 193 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook