Mercurial > hgbook
view en/Makefile @ 156:91a936be78b8
Document merge behaviour with file names.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 12 Mar 2007 23:11:26 -0700 |
parents | cf24633b8de7 |
children | e49f4451d0e3 |
line wrap: on
line source
# This makefile requires GNU make. hg_id := $(shell hg parents --template '{node|short}\n') sources := \ 00book.tex \ 99book.bib \ 99defs.tex \ build_id.tex \ cmdref.tex \ concepts.tex \ daily.tex \ filenames.tex \ hook.tex \ intro.tex \ mq.tex \ mq-collab.tex \ mq-ref.tex \ preface.tex \ srcinstall.tex \ template.tex \ tour-basic.tex \ tour-merge.tex \ undo.tex image-sources := \ filelog.svg \ kdiff3.png \ metadata.svg \ mq-stack.svg \ note.png \ revlog.svg \ snapshot.svg \ tour-history.svg \ tour-merge-conflict.svg \ tour-merge-merge.svg \ tour-merge-pull.svg \ tour-merge-sep-repos.svg \ undo-manual.dot \ undo-manual-merge.dot \ undo-non-tip.dot \ undo-simple.dot \ wdir.svg \ wdir-after-commit.svg \ wdir-branch.svg \ wdir-merge.svg \ wdir-pre-branch.svg image-dot := $(filter %.dot,$(image-sources)) image-svg := $(filter %.svg,$(image-sources)) image-png := $(filter %.png,$(image-sources)) example-sources := \ backout \ bisect \ cmdref \ daily.copy \ daily.files \ daily.rename \ daily.revert \ filenames \ hook.msglen \ hook.simple \ hook.ws \ issue29 \ mq.guards \ mq.qinit-help \ mq.dodiff \ mq.id \ mq.tarball \ mq.tools \ mq.tutorial \ rename.divergent \ rollback \ template.simple \ template.svnstyle \ tour \ tour-merge-conflict latex-options = \ -interaction batchmode \ -output-directory $(dir $(1)) \ -jobname $(basename $(notdir $(1))) all: pdf html pdf: pdf/hgbook.pdf define pdf mkdir -p $(dir $@) TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) cp 99book.bib $(dir $@) cd $(dir $@) && bibtex $(basename $(notdir $@)) cd $(dir $@) && makeindex $(basename $(notdir $@)) TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi endef image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png) pdf/hgbook.pdf: $(sources) $(image-pdf) examples $(call pdf) html: onepage split onepage: html/onepage/hgbook.html split: html/split/hgbook.html # This is a horrible hack to work around the fact that the htlatex # command in tex4ht is itself a horrible hack. I really don't want to # include verbatim the big wad of TeX that is repeated in that script, # so instead I mangle the script itself. define htlatex mkdir -p $(dir $(1)) head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book cp 99book.bib $(dir $@) echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book echo 'echo status $$$$' >> $(dir $(1))/htlatex.book chmod 755 $(dir $(1))/htlatex.book TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) ./fixhtml.py $(dir $(1))/*.html endef image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg $(call htlatex,$@,$<) cp $(image-sources:%.svg=%.png) $(dir $@) cp hgbook.css $(dir $@) html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg $(call htlatex,$@,$<,2) cp $(image-sources:%.svg=%.png) $(dir $@) cp hgbook.css $(dir $@) # Produce 90dpi PNGs for the web. %.png: %.svg inkscape -D -e $@ $< %.svg: %.dot dot -Tsvg -o $@ $< # Produce eps & pdf for the pdf %.pdf: %.eps epstopdf $< %.eps: %.svg inkscape -E $@ $< %.eps: %.dot dot -Tps -o $@ $< examples: examples/.run examples/.run: $(example-sources:%=examples/%.run) touch examples/.run examples/%.run: examples/% examples/run-example cd examples && ./run-example $(notdir $<) build_id.tex: $(wildcard ../.hg/00changelog.[id]) echo -n $(hg_id) > build_id.tex clean: rm -rf dist html pdf \ $(image-dot:%.dot=%.pdf) \ $(image-dot:%.dot=%.png) \ $(image-svg:%.svg=%.pdf) \ $(image-svg:%.svg=%.png) \ examples/*.{lxo,run} examples/.run build_id.tex install: pdf split rm -rf dist mkdir -p dist cp pdf/hgbook.pdf dist cp html/split/*.{css,html,png} dist rsync: install rsync -avz --delete dist sp.red-bean.com:public_html/hgbook