hgbook

diff ja/Makefile @ 919:07676b6f6545

Merge with http://bitbucket.org/gpiancastelli/hgbook-it/
author Bryan O'Sullivan <bos@serpentine.com>
date Tue Oct 27 21:31:47 2009 -0700 (2009-10-27)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ja/Makefile	Tue Oct 27 21:31:47 2009 -0700
     1.3 @@ -0,0 +1,324 @@
     1.4 +# This makefile requires GNU make.
     1.5 +
     1.6 +sources := \
     1.7 +	00book.tex \
     1.8 +	99book.bib \
     1.9 +	99defs.tex \
    1.10 +	build_id.tex \
    1.11 +	branch.tex \
    1.12 +	collab.tex \
    1.13 +	concepts.tex \
    1.14 +	custom.sty \
    1.15 +	daily.tex \
    1.16 +	filenames.tex \
    1.17 +	hg_id.tex \
    1.18 +	hgext.tex \
    1.19 +	hook.tex \
    1.20 +	intro.tex \
    1.21 +	mq.tex \
    1.22 +	mq-collab.tex \
    1.23 +	preface.tex \
    1.24 +	srcinstall.tex \
    1.25 +	template.tex \
    1.26 +	tour-basic.tex \
    1.27 +	tour-merge.tex \
    1.28 +	undo.tex \
    1.29 +
    1.30 +
    1.31 +image-sources := \
    1.32 +	feature-branches.dot \
    1.33 +	filelog.svg \
    1.34 +	kdiff3.png \
    1.35 +	metadata.svg \
    1.36 +	mq-stack.svg \
    1.37 +	note.png \
    1.38 +	revlog.svg \
    1.39 +	snapshot.svg \
    1.40 +	tour-history.svg \
    1.41 +	tour-merge-conflict.svg \
    1.42 +	tour-merge-merge.svg \
    1.43 +	tour-merge-pull.svg \
    1.44 +	tour-merge-sep-repos.svg \
    1.45 +	undo-manual.dot \
    1.46 +	undo-manual-merge.dot \
    1.47 +	undo-non-tip.dot \
    1.48 +	undo-simple.dot \
    1.49 +	wdir.svg \
    1.50 +	wdir-after-commit.svg \
    1.51 +	wdir-branch.svg \
    1.52 +	wdir-merge.svg \
    1.53 +	wdir-pre-branch.svg \
    1.54 +
    1.55 +
    1.56 +image-dot := $(filter %.dot,$(image-sources))
    1.57 +image-svg := $(filter %.svg,$(image-sources))
    1.58 +image-png := $(filter %.png,$(image-sources))
    1.59 +
    1.60 +image-pdf := \
    1.61 +	$(image-dot:%.dot=%.pdf) \
    1.62 +	$(image-svg:%.svg=%.pdf) \
    1.63 +	$(image-png) \
    1.64 +
    1.65 +
    1.66 +bb-pdf := \
    1.67 +	$(image-dot:%.dot=%.bb) \
    1.68 +	$(image-svg:%.svg=%.bb) \
    1.69 +	$(image-png:%.png=%.bb) \
    1.70 +
    1.71 +
    1.72 +image-html := \
    1.73 +	$(image-dot:%.dot=%.png) \
    1.74 +	$(image-svg:%.svg=%.png) \
    1.75 +	$(image-png) \
    1.76 +
    1.77 +
    1.78 +example-sources := \
    1.79 +	backout \
    1.80 +	bisect \
    1.81 +	branching \
    1.82 +	branch-named \
    1.83 +	branch-repo \
    1.84 +	cmdref \
    1.85 +	daily.copy \
    1.86 +	daily.files \
    1.87 +	daily.rename \
    1.88 +	daily.revert \
    1.89 +	extdiff \
    1.90 +	filenames \
    1.91 +	hook.msglen \
    1.92 +	hook.simple \
    1.93 +	hook.ws \
    1.94 +	issue29 \
    1.95 +	mq.guards \
    1.96 +	mq.qinit-help \
    1.97 +	mq.dodiff \
    1.98 +	mq.id \
    1.99 +	mq.tarball \
   1.100 +	mq.tools \
   1.101 +	mq.tutorial \
   1.102 +	rename.divergent \
   1.103 +	rollback \
   1.104 +	tag \
   1.105 +	template.simple \
   1.106 +	template.svnstyle \
   1.107 +	tour \
   1.108 +	tour-merge-conflict \
   1.109 +
   1.110 +
   1.111 +example-prereqs := \
   1.112 +	/usr/bin/merge \
   1.113 +
   1.114 +
   1.115 +binary-staffs := \
   1.116 +	kdiff3.png \
   1.117 +	note.png \
   1.118 +	examples/data/netplug-1.2.5.tar.bz2 \
   1.119 +	examples/data/netplug-1.2.8.tar.bz2 \
   1.120 +
   1.121 +
   1.122 +dist-sources := \
   1.123 +	../html/hgicon.png \
   1.124 +	../html/index.html.var \
   1.125 +	../html/index.en.html \
   1.126 +
   1.127 +
   1.128 +latex-options = \
   1.129 +	-interaction batchmode \
   1.130 +	-output-directory $(dir $(1)) \
   1.131 +	-jobname $(basename $(notdir $(1))) \
   1.132 +
   1.133 +hg = $(shell which hg)
   1.134 +
   1.135 +hg-id = 
   1.136 +
   1.137 +hg-version = unknown
   1.138 +
   1.139 +########################################
   1.140 +
   1.141 +SVG2PNG = sh svg2png.sh
   1.142 +
   1.143 +SVG2EPS = sh svg2eps.sh
   1.144 +
   1.145 +GS = gs
   1.146 +
   1.147 +MAKEINDEX= mendex -J -f
   1.148 +
   1.149 +########################################
   1.150 +
   1.151 +all: pdf html
   1.152 +
   1.153 +pdf: pdf/hgbook.pdf
   1.154 +
   1.155 +define pdf
   1.156 +	mkdir -p $(dir $@)
   1.157 +	platex $(call latex-options,$@) $(1) \
   1.158 +	|| (rm -f $@; exit 1)
   1.159 +	cp 99book.bib $(dir $@)
   1.160 +	cd $(dir $@) && jbibtex $(basename $(notdir $@))
   1.161 +	cd $(dir $@) && $(MAKEINDEX) $(basename $(notdir $@))
   1.162 +	platex $(call latex-options,$@) $(1) \
   1.163 +	|| (rm -f $@; exit 1)
   1.164 +	platex $(call latex-options,$@) $(1) \
   1.165 +	|| (rm -f $@; exit 1)
   1.166 +	export TEXINPUTS=..; cd $(dir $@) && dvipdfmx $(basename $(notdir $@))
   1.167 +#	if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
   1.168 +endef
   1.169 +
   1.170 +pdf/hgbook.pdf: $(sources) atbegxxx.tex
   1.171 +pdf/hgbook.pdf: $(image-pdf)
   1.172 +pdf/hgbook.pdf: $(bb-pdf)
   1.173 +#pdf/hgbook.pdf: examples
   1.174 +pdf/hgbook.pdf: 00book_pdf.tex
   1.175 +	$(call pdf,00book_pdf.tex)
   1.176 +
   1.177 +html: onepage split
   1.178 +
   1.179 +htlatex := htlatex.sh
   1.180 +
   1.181 +onepage: $(htlatex)
   1.182 +onepage: html/onepage/hgbook.html
   1.183 +onepage: html/onepage/hgbook.css
   1.184 +onepage: $(image-html:%=html/onepage/%)
   1.185 +
   1.186 +html/onepage/%: %
   1.187 +	cp $< $@
   1.188 +
   1.189 +split: $(htlatex)
   1.190 +split: html/split/hgbook.html
   1.191 +split: html/split/hgbook.css
   1.192 +split: $(image-html:%=html/split/%)
   1.193 +
   1.194 +html/split/%: %
   1.195 +	cp $< $@
   1.196 +
   1.197 +# This is a horrible hack to work around the fact that the htlatex
   1.198 +# command in tex4ht is itself a horrible hack.  I really don't want to
   1.199 +# include verbatim the big wad of TeX that is repeated in that script,
   1.200 +# but I've given up and run a hacked copy as htlatex.book here.
   1.201 +
   1.202 +define htlatex
   1.203 +	mkdir -p $(dir $@)
   1.204 +	sh ./htlatex.sh \
   1.205 +		$(1) \
   1.206 +		"bookhtml,html4-uni,$(2)" \
   1.207 +		"$(call latex-options,$@)" \
   1.208 +	|| (rm -f $@; exit 1)
   1.209 +	cp 99book.bib $(dir $@)
   1.210 +	cd $(dir $@) && jbibtex $(basename $(notdir $@))
   1.211 +	cd $(dir $@) \
   1.212 +	&& jtex '\def\filename{{hgbook}{idx}{4dx}{ind}} \input idxmake.4ht' \
   1.213 +	&& $(MAKEINDEX) \
   1.214 +		-o $(basename $(notdir $@)).ind \
   1.215 +		$(basename $(notdir $@)).4dx
   1.216 +	sh ./htlatex.sh \
   1.217 +		$(1) \
   1.218 +		"bookhtml,html4-uni,$(2)" \
   1.219 +		"$(call latex-options,$@)" \
   1.220 +	|| (rm -f $@; exit 1)
   1.221 +	sh ./htlatex.sh \
   1.222 +		$(1) \
   1.223 +		"bookhtml,html4-uni,$(2)" \
   1.224 +		"$(call latex-options,$@)" \
   1.225 +	|| (rm -f $@; exit 1)
   1.226 +	cd $(dir $@) && tex4ht -f/$(basename $(notdir $@)) -cvalidate -cunihtf
   1.227 +	cd $(dir $@) && t4ht -f/$(basename $(notdir $@))
   1.228 +	python ./fixhtml.py $(dir $@)/*.html
   1.229 +	rm $(dir $@)/hgbook.css
   1.230 +endef
   1.231 +
   1.232 +html/onepage/hgbook.html: $(sources)
   1.233 +html/onepage/hgbook.html: $(image-html)
   1.234 +#html/onepage/hgbook.html: examples
   1.235 +html/onepage/hgbook.html: bookhtml.cfg
   1.236 +html/onepage/hgbook.html: 00book_html.tex
   1.237 +	$(call htlatex,00book_html.tex)
   1.238 +
   1.239 +html/split/hgbook.html: $(sources)
   1.240 +html/split/hgbook.html: $(image-html)
   1.241 +#html/split/hgbook.html: examples
   1.242 +html/split/hgbook.html: bookhtml.cfg
   1.243 +html/split/hgbook.html: 00book_html.tex
   1.244 +	$(call htlatex,00book_html.tex,2)
   1.245 +
   1.246 +# Produce 90dpi PNGs for the web.
   1.247 +
   1.248 +%.png: %.svg
   1.249 +	$(SVG2PNG) $@ $<
   1.250 +
   1.251 +%.svg: %.dot
   1.252 +	dot -Tsvg -o $@ $<
   1.253 +
   1.254 +# Produce eps/pdf/bb for the pdf
   1.255 +
   1.256 +%.pdf: %.eps
   1.257 +	epstopdf $<
   1.258 +
   1.259 +%.eps: %.svg
   1.260 +	$(SVG2EPS) $@ $<
   1.261 +
   1.262 +%.eps: %.dot
   1.263 +	dot -Tps -o $@ $<
   1.264 +
   1.265 +%.bb: %.pdf
   1.266 +	$(GS) -q -sDEVICE=bbox -dAutoRotatePages=/None - -c quit - \
   1.267 +		< $< > $@ 2>&1
   1.268 +
   1.269 +%.bb: %.png
   1.270 +	ebb $<
   1.271 +
   1.272 +examples: $(example-prereqs) $(binary-staffs) examples/.run
   1.273 +
   1.274 +examples/.run: $(example-sources:%=examples/%.run)
   1.275 +	touch examples/.run
   1.276 +
   1.277 +examples/%.run: examples/% examples/run-example
   1.278 +	cd examples && python ./run-example $(notdir $<)
   1.279 +
   1.280 +changelog := $(wildcard ../.hg/store/00changelog.[id])
   1.281 +ifeq ($(changelog),)
   1.282 +changelog := $(wildcard ../.hg/00changelog.[id])
   1.283 +endif
   1.284 +
   1.285 +build_id.tex: $(changelog)
   1.286 +	echo -n '$(hg-id)' > build_id.tex
   1.287 +
   1.288 +hg_id.tex: $(hg)
   1.289 +	echo -n '$(hg-version)' > hg_id.tex
   1.290 +
   1.291 +clean:
   1.292 +	rm -rf dist html pdf \
   1.293 +		$(image-dot:%.dot=%.pdf) \
   1.294 +		$(image-dot:%.dot=%.png) \
   1.295 +		$(image-dot:%.dot=%.bb) \
   1.296 +		$(image-svg:%.svg=%.pdf) \
   1.297 +		$(image-svg:%.svg=%.png) \
   1.298 +		$(image-svg:%.svg=%.bb) \
   1.299 +		$(image-png:%.png=%.bb) \
   1.300 +		examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex
   1.301 +	rm -f atbegxxx.tex
   1.302 +
   1.303 +install: pdf split $(dist-sources)
   1.304 +	rm -rf dist
   1.305 +	mkdir -p dist
   1.306 +	cp pdf/hgbook.pdf dist
   1.307 +	cp html/split/*.{css,html,png} dist
   1.308 +	cp $(dist-sources) dist
   1.309 +
   1.310 +rsync: install
   1.311 +	rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
   1.312 +
   1.313 +##### these targets are needed because mq can not handle binary files
   1.314 +
   1.315 +kdiff3.png:
   1.316 +	cp ../en/kdiff3.png .
   1.317 +
   1.318 +note.png:
   1.319 +	cp ../en/note.png .
   1.320 +
   1.321 +examples/data/netplug-1.2.5.tar.bz2:
   1.322 +	mkdir -p examples/data
   1.323 +	cp ../en/examples/data/netplug-1.2.5.tar.bz2 examples/data
   1.324 +
   1.325 +examples/data/netplug-1.2.8.tar.bz2:
   1.326 +	mkdir -p examples/data
   1.327 +	cp ../en/examples/data/netplug-1.2.8.tar.bz2 examples/data