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