hgbook

annotate es/Makefile @ 377:d5f1049a79dd

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