hgbook

diff en/Makefile @ 57:fa8bafe467cb

Merge with upstream
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Tue Jul 25 00:02:24 2006 -0400 (2006-07-25)
parents b8539d91c84d dd657c4d3a47
children 3649ee841264
line diff
     1.1 --- a/en/Makefile	Mon Jul 24 23:57:52 2006 -0400
     1.2 +++ b/en/Makefile	Tue Jul 25 00:02:24 2006 -0400
     1.3 @@ -1,121 +1,126 @@
     1.4 -# This makefile requires GNU make.
     1.5 -
     1.6 -hg_id := $(shell hg parents --template '{node|short}\n' | head -1)
     1.7 -
     1.8 -sources := \
     1.9 -	00book.tex \
    1.10 -	99book.bib \
    1.11 -	99defs.tex \
    1.12 -	build_id.tex \
    1.13 -	concepts.tex \
    1.14 -	hook.tex \
    1.15 -	intro.tex \
    1.16 -	mq.tex \
    1.17 -	preface.tex
    1.18 -
    1.19 -image-sources := \
    1.20 -	mq-stack.svg
    1.21 -
    1.22 -example-sources := \
    1.23 -	examples/run-example \
    1.24 -	examples/hook.simple \
    1.25 -	examples/concepts \
    1.26 -	examples/mq.qinit-help \
    1.27 -	examples/mq.diff \
    1.28 -	examples/mq.tarball \
    1.29 -	examples/mq.tools \
    1.30 -	examples/mq.tutorial
    1.31 -
    1.32 -latex-options = \
    1.33 -	-interaction batchmode \
    1.34 -	-output-directory $(dir $(1)) \
    1.35 -	-jobname $(basename $(notdir $(1)))
    1.36 -
    1.37 -all: pdf html
    1.38 -
    1.39 -pdf: pdf/hgbook.pdf
    1.40 -
    1.41 -define pdf
    1.42 -	mkdir -p $(dir $@)
    1.43 -	TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
    1.44 -	cp 99book.bib $(dir $@)
    1.45 -	cd $(dir $@) && bibtex $(basename $(notdir $@))
    1.46 -	cd $(dir $@) && makeindex $(basename $(notdir $@))
    1.47 -	TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
    1.48 -	TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
    1.49 -	if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
    1.50 -endef
    1.51 -
    1.52 -pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%.pdf) examples
    1.53 -	$(call pdf)
    1.54 -
    1.55 -html: html/onepage/hgbook.html html/split/hgbook.html
    1.56 -
    1.57 -# This is a horrible hack to work around the fact that the htlatex
    1.58 -# command in tex4ht is itself a horrible hack.  I really don't want to
    1.59 -# include verbatim the big wad of TeX that is repeated in that script,
    1.60 -# so instead I mangle the script itself.
    1.61 -
    1.62 -define htlatex
    1.63 -	mkdir -p $(dir $(1))
    1.64 -	head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
    1.65 -	cp 99book.bib $(dir $@)
    1.66 -	echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
    1.67 -	echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
    1.68 -	head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
    1.69 -	echo 'echo status $$$$' >>  $(dir $(1))/htlatex.book
    1.70 -	chmod 755 $(dir $(1))/htlatex.book
    1.71 -	TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
    1.72 -	cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
    1.73 -	cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
    1.74 -	perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
    1.75 -endef
    1.76 -
    1.77 -html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
    1.78 -	$(call htlatex,$@,$<)
    1.79 -	cp $(image-sources:%.svg=%.png) $(dir $@)
    1.80 -
    1.81 -html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
    1.82 -	$(call htlatex,$@,$<,2)
    1.83 -	cp $(image-sources:%.svg=%.png) $(dir $@)
    1.84 -
    1.85 -beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
    1.86 -
    1.87 -beta/%.tex: %.tex
    1.88 -	./fblinks $(hg_id) $(dir $@) $<
    1.89 -
    1.90 -beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks
    1.91 -	$(call pdf)
    1.92 -
    1.93 -beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
    1.94 -	$(call htlatex,$@,$<)
    1.95 -	cp $(image-sources:%.svg=%.png) $(dir $@)
    1.96 -
    1.97 -beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
    1.98 -	$(call htlatex,$@,$<,2)
    1.99 -	cp $(image-sources:%.svg=%.png) $(dir $@)
   1.100 -
   1.101 -# Produce 90dpi PNGs for the web.
   1.102 -
   1.103 -%.png: %.svg
   1.104 -	inkscape -D -e $@ $<
   1.105 -
   1.106 -# Produce eps & pdf for the pdf
   1.107 -
   1.108 -%.pdf: %.eps
   1.109 -	epstopdf $<
   1.110 -
   1.111 -%.eps: %.svg
   1.112 -	inkscape -E $@ $<
   1.113 -
   1.114 -examples: examples/.run
   1.115 -
   1.116 -examples/.run: $(example-sources)
   1.117 -	cd examples && ./run-example
   1.118 -
   1.119 -build_id.tex: $(wildcard ../.hg/00changelog.[id])
   1.120 -	echo -n $(hg_id) > build_id.tex
   1.121 -
   1.122 -clean:
   1.123 -	rm -rf beta html pdf *.eps *.pdf *.png *.aux *.dvi *.log *.out \
   1.124 -		examples/*.out examples/.run build_id.tex
   1.125 +# This makefile requires GNU make.
   1.126 +
   1.127 +hg_id := $(shell hg parents --template '{node|short}\n' | head -1)
   1.128 +
   1.129 +sources := \
   1.130 +	00book.tex \
   1.131 +	99book.bib \
   1.132 +	99defs.tex \
   1.133 +	build_id.tex \
   1.134 +	concepts.tex \
   1.135 +	daily.tex \
   1.136 +	hook.tex \
   1.137 +	intro.tex \
   1.138 +	mq.tex \
   1.139 +	preface.tex
   1.140 +
   1.141 +image-sources := \
   1.142 +	mq-stack.svg
   1.143 +
   1.144 +example-sources := \
   1.145 +	examples/daily.files \
   1.146 +	examples/hook.simple \
   1.147 +	examples/hook.ws \
   1.148 +	examples/concepts \
   1.149 +	examples/mq.qinit-help \
   1.150 +	examples/mq.dodiff \
   1.151 +	examples/mq.tarball \
   1.152 +	examples/mq.tools \
   1.153 +	examples/mq.tutorial
   1.154 +
   1.155 +latex-options = \
   1.156 +	-interaction batchmode \
   1.157 +	-output-directory $(dir $(1)) \
   1.158 +	-jobname $(basename $(notdir $(1)))
   1.159 +
   1.160 +all: pdf html
   1.161 +
   1.162 +pdf: pdf/hgbook.pdf
   1.163 +
   1.164 +define pdf
   1.165 +	mkdir -p $(dir $@)
   1.166 +	TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
   1.167 +	cp 99book.bib $(dir $@)
   1.168 +	cd $(dir $@) && bibtex $(basename $(notdir $@))
   1.169 +	cd $(dir $@) && makeindex $(basename $(notdir $@))
   1.170 +	TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
   1.171 +	TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
   1.172 +	if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
   1.173 +endef
   1.174 +
   1.175 +pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%.pdf) examples
   1.176 +	$(call pdf)
   1.177 +
   1.178 +html: html/onepage/hgbook.html html/split/hgbook.html
   1.179 +
   1.180 +# This is a horrible hack to work around the fact that the htlatex
   1.181 +# command in tex4ht is itself a horrible hack.  I really don't want to
   1.182 +# include verbatim the big wad of TeX that is repeated in that script,
   1.183 +# so instead I mangle the script itself.
   1.184 +
   1.185 +define htlatex
   1.186 +	mkdir -p $(dir $(1))
   1.187 +	head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
   1.188 +	cp 99book.bib $(dir $@)
   1.189 +	echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
   1.190 +	echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
   1.191 +	head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
   1.192 +	echo 'echo status $$$$' >>  $(dir $(1))/htlatex.book
   1.193 +	chmod 755 $(dir $(1))/htlatex.book
   1.194 +	TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
   1.195 +	cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
   1.196 +	cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
   1.197 +	perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
   1.198 +endef
   1.199 +
   1.200 +html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
   1.201 +	$(call htlatex,$@,$<)
   1.202 +	cp $(image-sources:%.svg=%.png) $(dir $@)
   1.203 +
   1.204 +html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples
   1.205 +	$(call htlatex,$@,$<,2)
   1.206 +	cp $(image-sources:%.svg=%.png) $(dir $@)
   1.207 +
   1.208 +beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
   1.209 +
   1.210 +beta/%.tex: %.tex
   1.211 +	./fblinks $(hg_id) $(dir $@) $<
   1.212 +
   1.213 +beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks
   1.214 +	$(call pdf)
   1.215 +
   1.216 +beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
   1.217 +	$(call htlatex,$@,$<)
   1.218 +	cp $(image-sources:%.svg=%.png) $(dir $@)
   1.219 +
   1.220 +beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
   1.221 +	$(call htlatex,$@,$<,2)
   1.222 +	cp $(image-sources:%.svg=%.png) $(dir $@)
   1.223 +
   1.224 +# Produce 90dpi PNGs for the web.
   1.225 +
   1.226 +%.png: %.svg
   1.227 +	inkscape -D -e $@ $<
   1.228 +
   1.229 +# Produce eps & pdf for the pdf
   1.230 +
   1.231 +%.pdf: %.eps
   1.232 +	epstopdf $<
   1.233 +
   1.234 +%.eps: %.svg
   1.235 +	inkscape -E $@ $<
   1.236 +
   1.237 +examples: examples/.run
   1.238 +
   1.239 +examples/.run: $(example-sources:%=%.run)
   1.240 +	touch examples/.run
   1.241 +
   1.242 +examples/%.run: examples/% examples/run-example
   1.243 +	cd examples && ./run-example $(notdir $<)
   1.244 +
   1.245 +build_id.tex: $(wildcard ../.hg/00changelog.[id])
   1.246 +	echo -n $(hg_id) > build_id.tex
   1.247 +
   1.248 +clean:
   1.249 +	rm -rf beta html pdf *.eps *.pdf *.png *.aux *.dvi *.log *.out \
   1.250 +		examples/*.{out,run} examples/.run build_id.tex