hgbook

annotate en/Makefile @ 582:5bfa0df6aaed

Automated merge with ssh://ssh.serpentine.com/hg/share/mercurial/book
author Bryan O'Sullivan <bos@serpentine.com>
date Wed Mar 18 00:08:22 2009 -0700 (2009-03-18)
parents 1879ec732a28 8366882f67f2
children 188efaefe001 d0160b0b1a9e
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@580 38 example-sources-by-name := \
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@580 70 example-sources := \
bos@580 71 $(example-sources-by-name:%=examples/%) \
bos@580 72 $(wildcard examples/ch*/*)
bos@580 73
bos@575 74 obj-web := html
bos@575 75 obj-websup := html/support
bos@575 76
bos@575 77 extras-web-base := \
bos@575 78 $(obj-web)/index.html \
bos@575 79 $(obj-web)/robots.txt \
bos@575 80 $(obj-websup)/form-min.js \
bos@575 81 $(obj-websup)/form.js \
bos@575 82 $(obj-websup)/hsbook.js \
bos@575 83 $(obj-websup)/jquery-min.js \
bos@575 84 $(obj-websup)/jquery.js \
bos@575 85 $(obj-websup)/styles.css
bos@575 86
bos@575 87 extras-web := $(extras-web-base) $(extras-web-base:%=%.gz)
bos@575 88
bos@558 89 xsltproc := xsltproc
bos@558 90 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
bos@558 91
bos@558 92 xmllint := xmllint
bos@558 93 xmllint-opts := --noout --nonet --valid
bos@558 94
bos@558 95 system-xsl-dir := $(firstword $(wildcard \
bos@558 96 /usr/share/sgml/docbook/xsl-stylesheets \
bos@558 97 /usr/share/xml/docbook/stylesheet/nwalsh \
bos@558 98 ))
bos@558 99
bos@558 100 # Bletcherousness.
bos@558 101
bos@558 102 ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),)
bos@558 103 dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*)
bos@558 104 else
bos@558 105 ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),)
bos@558 106 dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4)
bos@558 107 else
bos@558 108 $(error Do not know where to look for DocBook XML 4.4 DTD)
bos@558 109 endif
bos@558 110 endif
bos@558 111
bos@558 112 ifeq ($(system-xsl-dir),)
bos@558 113 $(error add a suitable directory to system-xsl-dir)
bos@558 114 endif
bos@558 115
bos@172 116 example-prereqs := \
bos@172 117 /usr/bin/merge
bos@172 118
bos@157 119 dist-sources := \
bos@159 120 ../html/hgicon.png \
bos@157 121 ../html/index.html.var \
bos@157 122 ../html/index.en.html
bos@157 123
bos@177 124 hg = $(shell which hg)
bos@177 125
bos@269 126 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n')
bos@177 127
bos@177 128 hg-version = $(shell hg version -q | \
bos@242 129 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
bos@177 130
bos@575 131 all: web
bos@149 132
bos@558 133 ../xsl/system-xsl: $(system-xsl-dir)
bos@558 134 ln -s $< $@
bos@558 135
bos@581 136 web: ../xsl/system-xsl websup html
bos@575 137
bos@571 138 html: ../xsl/system-xsl $(xml-src-files) valid
bos@575 139 xsltproc $(xsltproc-opts) -o html/read/x ../xsl/chunk-stylesheet.xsl 00book.xml
bos@575 140 for i in html/read/*.html; do \
bos@575 141 gzip -9 -c $$i > $$i.gz; \
bos@575 142 done
bos@575 143
bos@575 144 websup: $(extras-web)
bos@575 145 mkdir -p $(obj-websup)/figs
bos@575 146 cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs
bos@575 147 cp -f ../web/icons/*.png $(obj-websup)/figs
bos@575 148
bos@575 149 web: websup
bos@558 150
bos@558 151 valid: .validated-00book.xml
bos@558 152
bos@558 153 .validated-00book.xml: $(xml-src-files)
bos@558 154 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
bos@558 155 touch $@
bos@558 156
bos@18 157 # Produce 90dpi PNGs for the web.
bos@18 158
bos@309 159 %.png: %.svg fixsvg
hg@307 160 ./fixsvg $<
bos@309 161 inkscape -D -e $@ $<-tmp.svg
bos@309 162 rm $<-tmp.svg
bos@11 163
bos@124 164 %.svg: %.dot
bos@124 165 dot -Tsvg -o $@ $<
bos@124 166
bos@172 167 examples: $(example-prereqs) examples/.run
bos@4 168
bos@580 169 examples/.run: $(example-sources)
bos@580 170 cd examples && ./run-example
bos@45 171
bos@45 172 examples/%.run: examples/% examples/run-example
bos@4 173
bos@571 174 clean:
bos@571 175 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
bos@571 176 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
bos@250 177
bos@571 178 install: html $(dist-sources)
bos@153 179 rm -rf dist
bos@153 180 mkdir -p dist
bos@571 181 cp html/*.{css,html,png} dist
bos@157 182 cp $(dist-sources) dist
bos@153 183
bos@153 184 rsync: install
bos@153 185 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
bos@575 186
bos@575 187 vpath %.css ../web
bos@575 188 vpath %.js ../web/javascript
bos@575 189
bos@575 190 $(obj-websup)/%.css: %.css
bos@575 191 @mkdir -p $(dir $@)
bos@575 192 cp $< $@
bos@575 193
bos@575 194 $(obj-websup)/%.jpg: %.jpg
bos@575 195 @mkdir -p $(dir $@)
bos@575 196 cp $< $@
bos@575 197
bos@575 198 $(obj-websup)/%.js: %.js
bos@575 199 @mkdir -p $(dir $@)
bos@575 200 cp $< $@
bos@575 201
bos@575 202 $(obj-web)/%: ../web/%
bos@575 203 @mkdir -p $(dir $@)
bos@575 204 cp $< $@
bos@575 205
bos@575 206 $(obj-web)/%.html: %.html.in
bos@575 207 @mkdir -p $(dir $@)
bos@575 208 python ../web/texpand.py $< $@
bos@575 209
bos@575 210 %.gz: %
bos@575 211 gzip -9 -c $< > $@