hgbook

annotate ja/Makefile @ 1010:cd06c45e1631

French translation : ch06-collab.xml - about 50% translated
author Frédéric Bouquet <youshe.jaalon@gmail.com>
date Mon Sep 21 00:02:10 2009 +0200 (2009-09-21)
parents
children
rev   line source
foozy@708 1 # This makefile requires GNU make.
foozy@708 2
foozy@708 3 sources := \
foozy@708 4 00book.tex \
foozy@708 5 99book.bib \
foozy@708 6 99defs.tex \
foozy@708 7 build_id.tex \
foozy@708 8 branch.tex \
foozy@708 9 collab.tex \
foozy@708 10 concepts.tex \
foozy@708 11 custom.sty \
foozy@708 12 daily.tex \
foozy@708 13 filenames.tex \
foozy@708 14 hg_id.tex \
foozy@708 15 hgext.tex \
foozy@708 16 hook.tex \
foozy@708 17 intro.tex \
foozy@708 18 mq.tex \
foozy@708 19 mq-collab.tex \
foozy@708 20 preface.tex \
foozy@708 21 srcinstall.tex \
foozy@708 22 template.tex \
foozy@708 23 tour-basic.tex \
foozy@708 24 tour-merge.tex \
foozy@708 25 undo.tex \
foozy@708 26
foozy@708 27
foozy@708 28 image-sources := \
foozy@708 29 feature-branches.dot \
foozy@708 30 filelog.svg \
foozy@708 31 kdiff3.png \
foozy@708 32 metadata.svg \
foozy@708 33 mq-stack.svg \
foozy@708 34 note.png \
foozy@708 35 revlog.svg \
foozy@708 36 snapshot.svg \
foozy@708 37 tour-history.svg \
foozy@708 38 tour-merge-conflict.svg \
foozy@708 39 tour-merge-merge.svg \
foozy@708 40 tour-merge-pull.svg \
foozy@708 41 tour-merge-sep-repos.svg \
foozy@708 42 undo-manual.dot \
foozy@708 43 undo-manual-merge.dot \
foozy@708 44 undo-non-tip.dot \
foozy@708 45 undo-simple.dot \
foozy@708 46 wdir.svg \
foozy@708 47 wdir-after-commit.svg \
foozy@708 48 wdir-branch.svg \
foozy@708 49 wdir-merge.svg \
foozy@708 50 wdir-pre-branch.svg \
foozy@708 51
foozy@708 52
foozy@708 53 image-dot := $(filter %.dot,$(image-sources))
foozy@708 54 image-svg := $(filter %.svg,$(image-sources))
foozy@708 55 image-png := $(filter %.png,$(image-sources))
foozy@708 56
foozy@708 57 image-pdf := \
foozy@708 58 $(image-dot:%.dot=%.pdf) \
foozy@708 59 $(image-svg:%.svg=%.pdf) \
foozy@708 60 $(image-png) \
foozy@708 61
foozy@708 62
foozy@708 63 bb-pdf := \
foozy@708 64 $(image-dot:%.dot=%.bb) \
foozy@708 65 $(image-svg:%.svg=%.bb) \
foozy@708 66 $(image-png:%.png=%.bb) \
foozy@708 67
foozy@708 68
foozy@708 69 image-html := \
foozy@708 70 $(image-dot:%.dot=%.png) \
foozy@708 71 $(image-svg:%.svg=%.png) \
foozy@708 72 $(image-png) \
foozy@708 73
foozy@708 74
foozy@708 75 example-sources := \
foozy@708 76 backout \
foozy@708 77 bisect \
foozy@708 78 branching \
foozy@708 79 branch-named \
foozy@708 80 branch-repo \
foozy@708 81 cmdref \
foozy@708 82 daily.copy \
foozy@708 83 daily.files \
foozy@708 84 daily.rename \
foozy@708 85 daily.revert \
foozy@708 86 extdiff \
foozy@708 87 filenames \
foozy@708 88 hook.msglen \
foozy@708 89 hook.simple \
foozy@708 90 hook.ws \
foozy@708 91 issue29 \
foozy@708 92 mq.guards \
foozy@708 93 mq.qinit-help \
foozy@708 94 mq.dodiff \
foozy@708 95 mq.id \
foozy@708 96 mq.tarball \
foozy@708 97 mq.tools \
foozy@708 98 mq.tutorial \
foozy@708 99 rename.divergent \
foozy@708 100 rollback \
foozy@708 101 tag \
foozy@708 102 template.simple \
foozy@708 103 template.svnstyle \
foozy@708 104 tour \
foozy@708 105 tour-merge-conflict \
foozy@708 106
foozy@708 107
foozy@708 108 example-prereqs := \
foozy@708 109 /usr/bin/merge \
foozy@708 110
foozy@708 111
foozy@708 112 binary-staffs := \
foozy@708 113 kdiff3.png \
foozy@708 114 note.png \
foozy@708 115 examples/data/netplug-1.2.5.tar.bz2 \
foozy@708 116 examples/data/netplug-1.2.8.tar.bz2 \
foozy@708 117
foozy@708 118
foozy@708 119 dist-sources := \
foozy@708 120 ../html/hgicon.png \
foozy@708 121 ../html/index.html.var \
foozy@708 122 ../html/index.en.html \
foozy@708 123
foozy@708 124
foozy@708 125 latex-options = \
foozy@708 126 -interaction batchmode \
foozy@708 127 -output-directory $(dir $(1)) \
foozy@708 128 -jobname $(basename $(notdir $(1))) \
foozy@708 129
foozy@708 130 hg = $(shell which hg)
foozy@708 131
foozy@708 132 hg-id =
foozy@708 133
foozy@708 134 hg-version = unknown
foozy@708 135
foozy@708 136 ########################################
foozy@708 137
foozy@708 138 SVG2PNG = sh svg2png.sh
foozy@708 139
foozy@708 140 SVG2EPS = sh svg2eps.sh
foozy@708 141
foozy@708 142 GS = gs
foozy@708 143
foozy@708 144 MAKEINDEX= mendex -J -f
foozy@708 145
foozy@708 146 ########################################
foozy@708 147
foozy@708 148 all: pdf html
foozy@708 149
foozy@708 150 pdf: pdf/hgbook.pdf
foozy@708 151
foozy@708 152 define pdf
foozy@708 153 mkdir -p $(dir $@)
foozy@708 154 platex $(call latex-options,$@) $(1) \
foozy@708 155 || (rm -f $@; exit 1)
foozy@708 156 cp 99book.bib $(dir $@)
foozy@708 157 cd $(dir $@) && jbibtex $(basename $(notdir $@))
foozy@708 158 cd $(dir $@) && $(MAKEINDEX) $(basename $(notdir $@))
foozy@708 159 platex $(call latex-options,$@) $(1) \
foozy@708 160 || (rm -f $@; exit 1)
foozy@708 161 platex $(call latex-options,$@) $(1) \
foozy@708 162 || (rm -f $@; exit 1)
foozy@708 163 export TEXINPUTS=..; cd $(dir $@) && dvipdfmx $(basename $(notdir $@))
foozy@708 164 # if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
foozy@708 165 endef
foozy@708 166
foozy@708 167 pdf/hgbook.pdf: $(sources) atbegxxx.tex
foozy@708 168 pdf/hgbook.pdf: $(image-pdf)
foozy@708 169 pdf/hgbook.pdf: $(bb-pdf)
foozy@708 170 #pdf/hgbook.pdf: examples
foozy@708 171 pdf/hgbook.pdf: 00book_pdf.tex
foozy@708 172 $(call pdf,00book_pdf.tex)
foozy@708 173
foozy@708 174 html: onepage split
foozy@708 175
foozy@708 176 htlatex := htlatex.sh
foozy@708 177
foozy@708 178 onepage: $(htlatex)
foozy@708 179 onepage: html/onepage/hgbook.html
foozy@708 180 onepage: html/onepage/hgbook.css
foozy@708 181 onepage: $(image-html:%=html/onepage/%)
foozy@708 182
foozy@708 183 html/onepage/%: %
foozy@708 184 cp $< $@
foozy@708 185
foozy@708 186 split: $(htlatex)
foozy@708 187 split: html/split/hgbook.html
foozy@708 188 split: html/split/hgbook.css
foozy@708 189 split: $(image-html:%=html/split/%)
foozy@708 190
foozy@708 191 html/split/%: %
foozy@708 192 cp $< $@
foozy@708 193
foozy@708 194 # This is a horrible hack to work around the fact that the htlatex
foozy@708 195 # command in tex4ht is itself a horrible hack. I really don't want to
foozy@708 196 # include verbatim the big wad of TeX that is repeated in that script,
foozy@708 197 # but I've given up and run a hacked copy as htlatex.book here.
foozy@708 198
foozy@708 199 define htlatex
foozy@708 200 mkdir -p $(dir $@)
foozy@708 201 sh ./htlatex.sh \
foozy@708 202 $(1) \
foozy@708 203 "bookhtml,html4-uni,$(2)" \
foozy@708 204 "$(call latex-options,$@)" \
foozy@708 205 || (rm -f $@; exit 1)
foozy@708 206 cp 99book.bib $(dir $@)
foozy@708 207 cd $(dir $@) && jbibtex $(basename $(notdir $@))
foozy@708 208 cd $(dir $@) \
foozy@708 209 && jtex '\def\filename{{hgbook}{idx}{4dx}{ind}} \input idxmake.4ht' \
foozy@708 210 && $(MAKEINDEX) \
foozy@708 211 -o $(basename $(notdir $@)).ind \
foozy@708 212 $(basename $(notdir $@)).4dx
foozy@708 213 sh ./htlatex.sh \
foozy@708 214 $(1) \
foozy@708 215 "bookhtml,html4-uni,$(2)" \
foozy@708 216 "$(call latex-options,$@)" \
foozy@708 217 || (rm -f $@; exit 1)
foozy@708 218 sh ./htlatex.sh \
foozy@708 219 $(1) \
foozy@708 220 "bookhtml,html4-uni,$(2)" \
foozy@708 221 "$(call latex-options,$@)" \
foozy@708 222 || (rm -f $@; exit 1)
foozy@708 223 cd $(dir $@) && tex4ht -f/$(basename $(notdir $@)) -cvalidate -cunihtf
foozy@708 224 cd $(dir $@) && t4ht -f/$(basename $(notdir $@))
foozy@708 225 python ./fixhtml.py $(dir $@)/*.html
foozy@708 226 rm $(dir $@)/hgbook.css
foozy@708 227 endef
foozy@708 228
foozy@708 229 html/onepage/hgbook.html: $(sources)
foozy@708 230 html/onepage/hgbook.html: $(image-html)
foozy@708 231 #html/onepage/hgbook.html: examples
foozy@708 232 html/onepage/hgbook.html: bookhtml.cfg
foozy@708 233 html/onepage/hgbook.html: 00book_html.tex
foozy@708 234 $(call htlatex,00book_html.tex)
foozy@708 235
foozy@708 236 html/split/hgbook.html: $(sources)
foozy@708 237 html/split/hgbook.html: $(image-html)
foozy@708 238 #html/split/hgbook.html: examples
foozy@708 239 html/split/hgbook.html: bookhtml.cfg
foozy@708 240 html/split/hgbook.html: 00book_html.tex
foozy@708 241 $(call htlatex,00book_html.tex,2)
foozy@708 242
foozy@708 243 # Produce 90dpi PNGs for the web.
foozy@708 244
foozy@708 245 %.png: %.svg
foozy@708 246 $(SVG2PNG) $@ $<
foozy@708 247
foozy@708 248 %.svg: %.dot
foozy@708 249 dot -Tsvg -o $@ $<
foozy@708 250
foozy@708 251 # Produce eps/pdf/bb for the pdf
foozy@708 252
foozy@708 253 %.pdf: %.eps
foozy@708 254 epstopdf $<
foozy@708 255
foozy@708 256 %.eps: %.svg
foozy@708 257 $(SVG2EPS) $@ $<
foozy@708 258
foozy@708 259 %.eps: %.dot
foozy@708 260 dot -Tps -o $@ $<
foozy@708 261
foozy@708 262 %.bb: %.pdf
foozy@708 263 $(GS) -q -sDEVICE=bbox -dAutoRotatePages=/None - -c quit - \
foozy@708 264 < $< > $@ 2>&1
foozy@708 265
foozy@708 266 %.bb: %.png
foozy@708 267 ebb $<
foozy@708 268
foozy@708 269 examples: $(example-prereqs) $(binary-staffs) examples/.run
foozy@708 270
foozy@708 271 examples/.run: $(example-sources:%=examples/%.run)
foozy@708 272 touch examples/.run
foozy@708 273
foozy@708 274 examples/%.run: examples/% examples/run-example
foozy@708 275 cd examples && python ./run-example $(notdir $<)
foozy@708 276
foozy@708 277 changelog := $(wildcard ../.hg/store/00changelog.[id])
foozy@708 278 ifeq ($(changelog),)
foozy@708 279 changelog := $(wildcard ../.hg/00changelog.[id])
foozy@708 280 endif
foozy@708 281
foozy@708 282 build_id.tex: $(changelog)
foozy@708 283 echo -n '$(hg-id)' > build_id.tex
foozy@708 284
foozy@708 285 hg_id.tex: $(hg)
foozy@708 286 echo -n '$(hg-version)' > hg_id.tex
foozy@708 287
foozy@708 288 clean:
foozy@708 289 rm -rf dist html pdf \
foozy@708 290 $(image-dot:%.dot=%.pdf) \
foozy@708 291 $(image-dot:%.dot=%.png) \
foozy@708 292 $(image-dot:%.dot=%.bb) \
foozy@708 293 $(image-svg:%.svg=%.pdf) \
foozy@708 294 $(image-svg:%.svg=%.png) \
foozy@708 295 $(image-svg:%.svg=%.bb) \
foozy@708 296 $(image-png:%.png=%.bb) \
foozy@708 297 examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex
foozy@708 298 rm -f atbegxxx.tex
foozy@708 299
foozy@708 300 install: pdf split $(dist-sources)
foozy@708 301 rm -rf dist
foozy@708 302 mkdir -p dist
foozy@708 303 cp pdf/hgbook.pdf dist
foozy@708 304 cp html/split/*.{css,html,png} dist
foozy@708 305 cp $(dist-sources) dist
foozy@708 306
foozy@708 307 rsync: install
foozy@708 308 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
foozy@708 309
foozy@708 310 ##### these targets are needed because mq can not handle binary files
foozy@708 311
foozy@708 312 kdiff3.png:
foozy@708 313 cp ../en/kdiff3.png .
foozy@708 314
foozy@708 315 note.png:
foozy@708 316 cp ../en/note.png .
foozy@708 317
foozy@708 318 examples/data/netplug-1.2.5.tar.bz2:
foozy@708 319 mkdir -p examples/data
foozy@708 320 cp ../en/examples/data/netplug-1.2.5.tar.bz2 examples/data
foozy@708 321
foozy@708 322 examples/data/netplug-1.2.8.tar.bz2:
foozy@708 323 mkdir -p examples/data
foozy@708 324 cp ../en/examples/data/netplug-1.2.8.tar.bz2 examples/data