hgbook

annotate es/Makefile @ 732:1c31e38a9720

Complete revision of Ch.2.
author Giulio@puck
date Sun Jun 28 17:18:56 2009 +0200 (2009-06-28)
parents 9412f706651e
children
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@506 97 ../html/index.en.html \
igor@506 98 ../html/index.es.html
igor@323 99
igor@323 100 latex-options = \
igor@323 101 -interaction batchmode \
igor@323 102 -output-directory $(dir $(1)) \
igor@323 103 -jobname $(basename $(notdir $(1)))
igor@323 104
igor@323 105 hg = $(shell which hg)
igor@323 106
jerojasro@514 107 hg-id = $(shell hg parents --template '{node|short}, fechado {date|isodate},\n')
igor@323 108
igor@323 109 hg-version = $(shell hg version -q | \
jerojasro@514 110 sed 's,.*(versiĆ³n \(unknown\|[a-f0-9+]*\)),\1,')
igor@323 111
igor@323 112 all: pdf html
igor@323 113
igor@323 114 pdf: pdf/hgbook.pdf
igor@323 115
igor@323 116 define pdf
igor@323 117 mkdir -p $(dir $@)
igor@323 118 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
igor@323 119 cp 99book.bib $(dir $@)
igor@323 120 cd $(dir $@) && bibtex $(basename $(notdir $@))
igor@323 121 cd $(dir $@) && makeindex $(basename $(notdir $@))
igor@323 122 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
igor@323 123 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
igor@323 124 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
igor@323 125 endef
igor@323 126
igor@323 127 pdf/hgbook.pdf: $(sources) examples $(image-pdf)
igor@323 128 $(call pdf)
igor@323 129
igor@323 130 html: onepage split
igor@323 131
igor@323 132 onepage: $(htlatex) html/onepage/hgbook.html html/onepage/hgbook.css $(image-html:%=html/onepage/%)
igor@323 133
igor@323 134 html/onepage/%: %
igor@323 135 cp $< $@
igor@323 136
igor@323 137 split: $(htlatex) html/split/hgbook.html html/split/hgbook.css $(image-html:%=html/split/%)
igor@323 138
igor@323 139 html/split/%: %
igor@323 140 cp $< $@
igor@323 141
igor@323 142 # This is a horrible hack to work around the fact that the htlatex
igor@323 143 # command in tex4ht is itself a horrible hack. I really don't want to
igor@323 144 # include verbatim the big wad of TeX that is repeated in that script,
igor@323 145 # but I've given up and run a hacked copy as htlatex.book here.
igor@323 146
igor@323 147 define htlatex
igor@323 148 mkdir -p $(dir $(1))
igor@323 149 cp 99book.bib $(dir $(1))
igor@323 150 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 151 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
igor@323 152 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
igor@323 153 ./fixhtml.py $(dir $(1))/*.html
igor@323 154 rm $(dir $(1))/hgbook.css
igor@323 155 endef
igor@323 156
igor@323 157 html/onepage/hgbook.html: $(sources) examples $(image-html) bookhtml.cfg
igor@323 158 $(call htlatex,$@,$<)
igor@323 159
igor@323 160 html/split/hgbook.html: $(sources) examples bookhtml.cfg
igor@323 161 $(call htlatex,$@,$<,2)
igor@323 162
igor@323 163 # Produce 90dpi PNGs for the web.
igor@323 164
igor@323 165 %.png: %.svg fixsvg
igor@323 166 ./fixsvg $<
igor@323 167 inkscape -D -e $@ $<-tmp.svg
igor@323 168 rm $<-tmp.svg
igor@323 169
igor@323 170 %.svg: %.dot
igor@323 171 dot -Tsvg -o $@ $<
igor@323 172
igor@323 173 # Produce eps & pdf for the pdf
igor@323 174
igor@323 175 %.pdf: %.eps
igor@323 176 epstopdf $<
igor@323 177
igor@323 178 %.eps: %.svg
igor@323 179 ./fixsvg $<
igor@323 180 inkscape -E $@ $<-tmp.svg
igor@323 181 rm $<-tmp.svg
igor@323 182
igor@323 183 %.eps: %.dot
igor@323 184 dot -Tps -o $@ $<
igor@323 185
igor@323 186 examples: $(example-prereqs) examples/.run
igor@323 187
igor@323 188 examples/.run: $(example-sources:%=examples/%.run)
igor@323 189 touch examples/.run
igor@323 190
igor@323 191 examples/%.run: examples/% examples/run-example
igor@323 192 cd examples && ./run-example $(notdir $<)
igor@323 193
igor@323 194 changelog := $(wildcard ../.hg/store/00changelog.[id])
igor@323 195 ifeq ($(changelog),)
igor@323 196 changelog := $(wildcard ../.hg/00changelog.[id])
igor@323 197 endif
igor@323 198
igor@323 199 build_id.tex: $(changelog)
igor@323 200 echo -n '$(hg-id)' > build_id.tex
igor@323 201
igor@323 202 hg_id.tex: $(hg)
igor@323 203 echo -n '$(hg-version)' > hg_id.tex
igor@323 204
igor@323 205 clean:
igor@323 206 rm -rf dist html pdf \
igor@323 207 $(image-dot:%.dot=%.pdf) \
igor@323 208 $(image-dot:%.dot=%.png) \
igor@323 209 $(image-svg:%.svg=%.pdf) \
igor@323 210 $(image-svg:%.svg=%.png) \
igor@323 211 examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex
igor@323 212
igor@512 213 install: pdf split $(dist-sources)
igor@323 214 rm -rf dist
igor@323 215 mkdir -p dist
igor@323 216 cp pdf/hgbook.pdf dist
igor@323 217 cp html/split/*.{css,html,png} dist
igor@512 218 cp html/onepage/hgbook.html dist/onepage.html
igor@512 219 ln -s index.es.html dist/index.html
igor@323 220 cp $(dist-sources) dist
igor@323 221
igor@323 222 rsync: install
igor@512 223 rsync -avz --delete dist/ ikks@sulaco.devnull.li:public_html/hgbook/