hgbook
annotate en/Makefile @ 171:8c1703a98266
Add a dependency on htlatex to HTML targets, even though we don't call it.
If the files it ships with aren't present, we can't build HTML.
If the files it ships with aren't present, we can't build HTML.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon Mar 26 23:57:58 2007 -0700 (2007-03-26) |
parents | 9cd856b4bd21 |
children | 5f305adeb584 |
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@159 | 11 collab.tex \ |
bos@59 | 12 concepts.tex \ |
bos@42 | 13 daily.tex \ |
bos@133 | 14 filenames.tex \ |
bos@34 | 15 hook.tex \ |
bos@16 | 16 intro.tex \ |
bos@16 | 17 mq.tex \ |
bos@104 | 18 mq-collab.tex \ |
bos@104 | 19 mq-ref.tex \ |
bos@76 | 20 preface.tex \ |
bos@85 | 21 srcinstall.tex \ |
bos@84 | 22 template.tex \ |
bos@95 | 23 tour-basic.tex \ |
bos@121 | 24 tour-merge.tex \ |
bos@121 | 25 undo.tex |
bos@0 | 26 |
bos@11 | 27 image-sources := \ |
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@133 | 57 cmdref \ |
bos@117 | 58 daily.copy \ |
bos@86 | 59 daily.files \ |
bos@118 | 60 daily.rename \ |
bos@122 | 61 daily.revert \ |
bos@133 | 62 filenames \ |
bos@86 | 63 hook.msglen \ |
bos@86 | 64 hook.simple \ |
bos@86 | 65 hook.ws \ |
bos@156 | 66 issue29 \ |
bos@104 | 67 mq.guards \ |
bos@86 | 68 mq.qinit-help \ |
bos@86 | 69 mq.dodiff \ |
bos@86 | 70 mq.id \ |
bos@86 | 71 mq.tarball \ |
bos@86 | 72 mq.tools \ |
bos@86 | 73 mq.tutorial \ |
bos@156 | 74 rename.divergent \ |
bos@121 | 75 rollback \ |
bos@86 | 76 template.simple \ |
bos@87 | 77 template.svnstyle \ |
bos@103 | 78 tour \ |
bos@103 | 79 tour-merge-conflict |
bos@4 | 80 |
bos@157 | 81 dist-sources := \ |
bos@159 | 82 ../html/hgicon.png \ |
bos@157 | 83 ../html/index.html.var \ |
bos@157 | 84 ../html/index.en.html |
bos@157 | 85 |
bos@0 | 86 latex-options = \ |
bos@0 | 87 -interaction batchmode \ |
bos@0 | 88 -output-directory $(dir $(1)) \ |
bos@0 | 89 -jobname $(basename $(notdir $(1))) |
bos@0 | 90 |
bos@0 | 91 all: pdf html |
bos@0 | 92 |
bos@0 | 93 pdf: pdf/hgbook.pdf |
bos@0 | 94 |
bos@18 | 95 define pdf |
bos@0 | 96 mkdir -p $(dir $@) |
bos@21 | 97 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
bos@2 | 98 cp 99book.bib $(dir $@) |
bos@2 | 99 cd $(dir $@) && bibtex $(basename $(notdir $@)) |
bos@16 | 100 cd $(dir $@) && makeindex $(basename $(notdir $@)) |
bos@21 | 101 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
bos@21 | 102 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
bos@26 | 103 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi |
bos@18 | 104 endef |
bos@18 | 105 |
bos@124 | 106 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png) |
bos@124 | 107 |
bos@124 | 108 pdf/hgbook.pdf: $(sources) $(image-pdf) examples |
bos@18 | 109 $(call pdf) |
bos@0 | 110 |
bos@149 | 111 html: onepage split |
bos@149 | 112 |
bos@171 | 113 htlatex := /usr/bin/htlatex |
bos@149 | 114 |
bos@171 | 115 onepage: $(htlatex) html/onepage/hgbook.html |
bos@171 | 116 |
bos@171 | 117 split: $(htlatex) html/split/hgbook.html |
bos@0 | 118 |
bos@18 | 119 # This is a horrible hack to work around the fact that the htlatex |
bos@18 | 120 # command in tex4ht is itself a horrible hack. I really don't want to |
bos@18 | 121 # include verbatim the big wad of TeX that is repeated in that script, |
bos@171 | 122 # but I've given up and run a hacked copy as htlatex.book here. |
bos@18 | 123 |
bos@0 | 124 define htlatex |
bos@0 | 125 mkdir -p $(dir $(1)) |
bos@170 | 126 cp 99book.bib $(dir $(1)) |
bos@170 | 127 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 | 128 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf |
bos@0 | 129 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) |
bos@149 | 130 ./fixhtml.py $(dir $(1))/*.html |
bos@0 | 131 endef |
bos@0 | 132 |
bos@124 | 133 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) |
bos@124 | 134 |
bos@149 | 135 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg |
bos@0 | 136 $(call htlatex,$@,$<) |
bos@11 | 137 cp $(image-sources:%.svg=%.png) $(dir $@) |
bos@149 | 138 cp hgbook.css $(dir $@) |
bos@0 | 139 |
bos@149 | 140 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg |
bos@0 | 141 $(call htlatex,$@,$<,2) |
bos@11 | 142 cp $(image-sources:%.svg=%.png) $(dir $@) |
bos@149 | 143 cp hgbook.css $(dir $@) |
bos@18 | 144 |
bos@18 | 145 # Produce 90dpi PNGs for the web. |
bos@18 | 146 |
bos@11 | 147 %.png: %.svg |
bos@11 | 148 inkscape -D -e $@ $< |
bos@11 | 149 |
bos@124 | 150 %.svg: %.dot |
bos@124 | 151 dot -Tsvg -o $@ $< |
bos@124 | 152 |
jeffpc@30 | 153 # Produce eps & pdf for the pdf |
bos@18 | 154 |
jeffpc@30 | 155 %.pdf: %.eps |
jeffpc@30 | 156 epstopdf $< |
jeffpc@30 | 157 |
jeffpc@30 | 158 %.eps: %.svg |
bos@32 | 159 inkscape -E $@ $< |
bos@11 | 160 |
bos@124 | 161 %.eps: %.dot |
bos@124 | 162 dot -Tps -o $@ $< |
bos@124 | 163 |
bos@4 | 164 examples: examples/.run |
bos@4 | 165 |
bos@86 | 166 examples/.run: $(example-sources:%=examples/%.run) |
bos@45 | 167 touch examples/.run |
bos@45 | 168 |
bos@45 | 169 examples/%.run: examples/% examples/run-example |
bos@45 | 170 cd examples && ./run-example $(notdir $<) |
bos@4 | 171 |
bos@18 | 172 build_id.tex: $(wildcard ../.hg/00changelog.[id]) |
bos@29 | 173 echo -n $(hg_id) > build_id.tex |
bos@16 | 174 |
bos@0 | 175 clean: |
bos@153 | 176 rm -rf dist html pdf \ |
bos@124 | 177 $(image-dot:%.dot=%.pdf) \ |
bos@124 | 178 $(image-dot:%.dot=%.png) \ |
bos@103 | 179 $(image-svg:%.svg=%.pdf) \ |
bos@103 | 180 $(image-svg:%.svg=%.png) \ |
bos@146 | 181 examples/*.{lxo,run} examples/.run build_id.tex |
bos@153 | 182 |
bos@157 | 183 install: pdf split $(dist-sources) |
bos@153 | 184 rm -rf dist |
bos@153 | 185 mkdir -p dist |
bos@153 | 186 cp pdf/hgbook.pdf dist |
bos@153 | 187 cp html/split/*.{css,html,png} dist |
bos@157 | 188 cp $(dist-sources) dist |
bos@153 | 189 |
bos@153 | 190 rsync: install |
bos@153 | 191 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook |