hgbook

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