bos@18: # This makefile requires GNU make. bos@18: bos@595: image-sources := $(wildcard figs/*.dot figs/*.gif figs/*.png figs/*.svg) bos@103: bos@558: xml-src-files := \ bos@558: 00book.xml \ bos@559: app*.xml \ bos@559: ch*.xml bos@558: bos@124: image-dot := $(filter %.dot,$(image-sources)) bos@103: image-svg := $(filter %.svg,$(image-sources)) bos@595: image-oth := $(filter %.gif %.png,$(image-sources)) bos@11: bos@594: obj-web := html bos@594: obj-websup := $(obj-web)/support bos@594: obj-web-read := $(obj-web)/read bos@594: bos@594: image-web := \ bos@594: $(image-dot:%.dot=$(obj-web-read)/%.png) \ bos@594: $(image-svg:%.svg=$(obj-web-read)/%.png) \ bos@595: $(image-oth:%=$(obj-web-read)/%) bos@213: bos@580: example-sources-by-name := \ bos@124: backout \ bos@131: bisect \ bos@179: branching \ bos@202: branch-named \ bos@198: branch-repo \ bos@133: cmdref \ bos@117: daily.copy \ bos@86: daily.files \ bos@118: daily.rename \ bos@122: daily.revert \ bos@226: extdiff \ bos@133: filenames \ bos@86: hook.msglen \ bos@86: hook.simple \ bos@86: hook.ws \ bos@156: issue29 \ bos@104: mq.guards \ bos@86: mq.qinit-help \ bos@86: mq.dodiff \ bos@86: mq.id \ bos@86: mq.tarball \ bos@86: mq.tools \ bos@86: mq.tutorial \ bos@156: rename.divergent \ bos@121: rollback \ bos@196: tag \ bos@86: template.simple \ bos@87: template.svnstyle \ bos@103: tour \ bos@103: tour-merge-conflict bos@4: bos@580: example-sources := \ bos@580: $(example-sources-by-name:%=examples/%) \ bos@580: $(wildcard examples/ch*/*) bos@580: bos@575: extras-web-base := \ bos@575: $(obj-web)/index.html \ bos@575: $(obj-web)/robots.txt \ bos@575: $(obj-websup)/form-min.js \ bos@575: $(obj-websup)/form.js \ bos@575: $(obj-websup)/hsbook.js \ bos@575: $(obj-websup)/jquery-min.js \ bos@575: $(obj-websup)/jquery.js \ bos@575: $(obj-websup)/styles.css bos@575: bos@575: extras-web := $(extras-web-base) $(extras-web-base:%=%.gz) bos@575: bos@558: xsltproc := xsltproc bos@558: xsltproc-opts := --nonet --xinclude --path '$(xml-path)' bos@558: bos@558: xmllint := xmllint bos@558: xmllint-opts := --noout --nonet --valid bos@558: bos@558: system-xsl-dir := $(firstword $(wildcard \ bos@558: /usr/share/sgml/docbook/xsl-stylesheets \ bos@558: /usr/share/xml/docbook/stylesheet/nwalsh \ bos@558: )) bos@558: bos@558: # Bletcherousness. bos@558: bos@558: ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),) bos@558: dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*) bos@558: else bos@558: ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),) bos@558: dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4) bos@558: else bos@558: $(error Do not know where to look for DocBook XML 4.4 DTD) bos@558: endif bos@558: endif bos@558: bos@558: ifeq ($(system-xsl-dir),) bos@558: $(error add a suitable directory to system-xsl-dir) bos@558: endif bos@558: bos@172: example-prereqs := \ bos@172: /usr/bin/merge bos@172: bos@157: dist-sources := \ bos@159: ../html/hgicon.png \ bos@157: ../html/index.html.var \ bos@157: ../html/index.en.html bos@157: bos@177: hg = $(shell which hg) bos@177: bos@269: hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n') bos@177: bos@177: hg-version = $(shell hg version -q | \ bos@242: sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,') bos@177: bos@575: all: web bos@149: dongsheng@654: ../stylesheets/system-xsl: $(system-xsl-dir) bos@558: ln -s $< $@ bos@558: dongsheng@654: web: ../stylesheets/system-xsl websup html bos@575: bos@594: html: $(obj-web-read)/index.html bos@594: bos@599: ../web/index-read.html.in: ../web/genindex.py $(xml-src-files) bos@599: $< bos@599: dongsheng@654: $(obj-web-read)/index.html: ../stylesheets/system-xsl .validated-00book.xml ../web/index-read.html.in dongsheng@654: xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../stylesheets/chunk-stylesheet.xsl 00book.xml bos@599: python ../web/texpand.py ../web/index-read.html.in html/read/index.html bos@594: for i in $(obj-web-read)/*.html; do \ bos@575: gzip -9 -c $$i > $$i.gz; \ bos@575: done bos@575: bos@594: websup: $(extras-web) $(image-web) bos@594: mkdir -p $(obj-websup)/figs $(obj-web-read)/figs dongsheng@654: cp ../stylesheets/system-xsl/images/*.png $(obj-websup)/figs bos@575: cp -f ../web/icons/*.png $(obj-websup)/figs bos@575: dongsheng@654: all-ids.dat: ../stylesheets/all-ids.xsl $(xml-src-files) dongsheng@654: $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/all-ids.xsl 00book.xml bos@588: bos@575: web: websup bos@558: bos@558: valid: .validated-00book.xml bos@558: bos@558: .validated-00book.xml: $(xml-src-files) bos@558: $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $< bos@558: touch $@ bos@558: bos@18: # Produce 90dpi PNGs for the web. bos@18: bos@594: $(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg bos@594: mkdir -p $(dir $@) hg@307: ./fixsvg $< bos@309: inkscape -D -e $@ $<-tmp.svg bos@309: rm $<-tmp.svg bos@11: bos@594: $(obj-web-read)/figs/%.png: figs/%.svg fixsvg bos@594: mkdir -p $(dir $@) bos@594: ./fixsvg $< bos@594: inkscape -D -e $@ $<-tmp.svg bos@594: rm $<-tmp.svg bos@594: bos@595: $(obj-web-read)/figs/%.gif: figs/%.gif bos@595: cp $< $@ bos@595: bos@594: $(obj-web-read)/figs/%.png: figs/%.png bos@594: cp $< $@ bos@594: bos@594: $(obj-web-read)/figs/%.svg: figs/%.dot bos@594: mkdir -p $(dir $@) bos@124: dot -Tsvg -o $@ $< bos@124: bos@172: examples: $(example-prereqs) examples/.run bos@4: bos@580: examples/.run: $(example-sources) bos@580: cd examples && ./run-example bos@45: bos@45: examples/%.run: examples/% examples/run-example bos@4: bos@571: clean: bos@571: -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \ bos@571: $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run bos@250: bos@571: install: html $(dist-sources) bos@153: rm -rf dist bos@153: mkdir -p dist bos@571: cp html/*.{css,html,png} dist bos@157: cp $(dist-sources) dist bos@153: bos@153: rsync: install bos@153: rsync -avz --delete dist sp.red-bean.com:public_html/hgbook bos@575: bos@575: vpath %.css ../web bos@598: vpath %.html.in ../web bos@575: vpath %.js ../web/javascript bos@575: bos@575: $(obj-websup)/%.css: %.css bos@575: @mkdir -p $(dir $@) bos@575: cp $< $@ bos@575: bos@575: $(obj-websup)/%.jpg: %.jpg bos@575: @mkdir -p $(dir $@) bos@575: cp $< $@ bos@575: bos@575: $(obj-websup)/%.js: %.js bos@575: @mkdir -p $(dir $@) bos@575: cp $< $@ bos@575: bos@575: $(obj-web)/%: ../web/% bos@575: @mkdir -p $(dir $@) bos@575: cp $< $@ bos@575: bos@575: $(obj-web)/%.html: %.html.in bos@575: @mkdir -p $(dir $@) bos@575: python ../web/texpand.py $< $@ bos@575: bos@575: %.gz: % bos@575: gzip -9 -c $< > $@