hgbook

annotate en/Makefile @ 571:3bcc001ce34f

Get rid of lots of TeX-era cruft.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon Mar 09 23:37:19 2009 -0700 (2009-03-09)
parents 27043f385f3f
children bebd5ff7fe7f
rev   line source
bos@18 1 # This makefile requires GNU make.
bos@18 2
bos@11 3 image-sources := \
bos@179 4 feature-branches.dot \
bos@108 5 filelog.svg \
bos@103 6 kdiff3.png \
bos@109 7 metadata.svg \
bos@96 8 mq-stack.svg \
bos@149 9 note.png \
bos@112 10 revlog.svg \
bos@110 11 snapshot.svg \
bos@99 12 tour-history.svg \
bos@103 13 tour-merge-conflict.svg \
bos@103 14 tour-merge-merge.svg \
bos@100 15 tour-merge-pull.svg \
bos@113 16 tour-merge-sep-repos.svg \
bos@124 17 undo-manual.dot \
bos@124 18 undo-manual-merge.dot \
bos@124 19 undo-non-tip.dot \
bos@124 20 undo-simple.dot \
bos@113 21 wdir.svg \
bos@115 22 wdir-after-commit.svg \
bos@115 23 wdir-branch.svg \
bos@115 24 wdir-merge.svg \
bos@115 25 wdir-pre-branch.svg
bos@103 26
bos@558 27 xml-src-files := \
bos@558 28 00book.xml \
bos@559 29 app*.xml \
bos@559 30 ch*.xml
bos@558 31
bos@124 32 image-dot := $(filter %.dot,$(image-sources))
bos@103 33 image-svg := $(filter %.svg,$(image-sources))
bos@124 34 image-png := $(filter %.png,$(image-sources))
bos@11 35
bos@213 36 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
bos@213 37
bos@4 38 example-sources := \
bos@124 39 backout \
bos@131 40 bisect \
bos@179 41 branching \
bos@202 42 branch-named \
bos@198 43 branch-repo \
bos@133 44 cmdref \
bos@117 45 daily.copy \
bos@86 46 daily.files \
bos@118 47 daily.rename \
bos@122 48 daily.revert \
bos@226 49 extdiff \
bos@133 50 filenames \
bos@86 51 hook.msglen \
bos@86 52 hook.simple \
bos@86 53 hook.ws \
bos@156 54 issue29 \
bos@104 55 mq.guards \
bos@86 56 mq.qinit-help \
bos@86 57 mq.dodiff \
bos@86 58 mq.id \
bos@86 59 mq.tarball \
bos@86 60 mq.tools \
bos@86 61 mq.tutorial \
bos@156 62 rename.divergent \
bos@121 63 rollback \
bos@196 64 tag \
bos@86 65 template.simple \
bos@87 66 template.svnstyle \
bos@103 67 tour \
bos@103 68 tour-merge-conflict
bos@4 69
bos@558 70 xsltproc := xsltproc
bos@558 71 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
bos@558 72
bos@558 73 xmllint := xmllint
bos@558 74 xmllint-opts := --noout --nonet --valid
bos@558 75
bos@558 76 system-xsl-dir := $(firstword $(wildcard \
bos@558 77 /usr/share/sgml/docbook/xsl-stylesheets \
bos@558 78 /usr/share/xml/docbook/stylesheet/nwalsh \
bos@558 79 ))
bos@558 80
bos@558 81 # Bletcherousness.
bos@558 82
bos@558 83 ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),)
bos@558 84 dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*)
bos@558 85 else
bos@558 86 ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),)
bos@558 87 dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4)
bos@558 88 else
bos@558 89 $(error Do not know where to look for DocBook XML 4.4 DTD)
bos@558 90 endif
bos@558 91 endif
bos@558 92
bos@558 93 ifeq ($(system-xsl-dir),)
bos@558 94 $(error add a suitable directory to system-xsl-dir)
bos@558 95 endif
bos@558 96
bos@172 97 example-prereqs := \
bos@172 98 /usr/bin/merge
bos@172 99
bos@157 100 dist-sources := \
bos@159 101 ../html/hgicon.png \
bos@157 102 ../html/index.html.var \
bos@157 103 ../html/index.en.html
bos@157 104
bos@177 105 hg = $(shell which hg)
bos@177 106
bos@269 107 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n')
bos@177 108
bos@177 109 hg-version = $(shell hg version -q | \
bos@242 110 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
bos@177 111
bos@571 112 all: html
bos@149 113
bos@558 114 ../xsl/system-xsl: $(system-xsl-dir)
bos@558 115 ln -s $< $@
bos@558 116
bos@571 117 html: ../xsl/system-xsl $(xml-src-files) valid
bos@571 118 xsltproc $(xsltproc-opts) -o html/x ../xsl/chunk-stylesheet.xsl 00book.xml
bos@558 119
bos@558 120 valid: .validated-00book.xml
bos@558 121
bos@558 122 .validated-00book.xml: $(xml-src-files)
bos@558 123 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
bos@558 124 touch $@
bos@558 125
bos@18 126 # Produce 90dpi PNGs for the web.
bos@18 127
bos@309 128 %.png: %.svg fixsvg
hg@307 129 ./fixsvg $<
bos@309 130 inkscape -D -e $@ $<-tmp.svg
bos@309 131 rm $<-tmp.svg
bos@11 132
bos@124 133 %.svg: %.dot
bos@124 134 dot -Tsvg -o $@ $<
bos@124 135
bos@172 136 examples: $(example-prereqs) examples/.run
bos@4 137
bos@86 138 examples/.run: $(example-sources:%=examples/%.run)
bos@45 139 touch examples/.run
bos@45 140
bos@45 141 examples/%.run: examples/% examples/run-example
bos@45 142 cd examples && ./run-example $(notdir $<)
bos@4 143
bos@571 144 clean:
bos@571 145 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
bos@571 146 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
bos@250 147
bos@571 148 install: html $(dist-sources)
bos@153 149 rm -rf dist
bos@153 150 mkdir -p dist
bos@571 151 cp html/*.{css,html,png} dist
bos@157 152 cp $(dist-sources) dist
bos@153 153
bos@153 154 rsync: install
bos@153 155 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook