hgbook

annotate en/Makefile @ 690:2c266a253b44

Merge with myself
author Bryan O'Sullivan <bos@serpentine.com>
date Sun Apr 26 23:23:06 2009 -0700 (2009-04-26)
parents 1c13ed2130a7 fbb4340be17a
children 88828b784971
rev   line source
bos@18 1 # This makefile requires GNU make.
bos@18 2
bos@595 3 image-sources := $(wildcard figs/*.dot figs/*.gif figs/*.png figs/*.svg)
bos@103 4
bos@558 5 xml-src-files := \
bos@558 6 00book.xml \
bos@559 7 app*.xml \
bos@559 8 ch*.xml
bos@558 9
bos@124 10 image-dot := $(filter %.dot,$(image-sources))
bos@103 11 image-svg := $(filter %.svg,$(image-sources))
bos@595 12 image-oth := $(filter %.gif %.png,$(image-sources))
bos@11 13
bos@594 14 obj-web := html
bos@594 15 obj-websup := $(obj-web)/support
bos@594 16 obj-web-read := $(obj-web)/read
bos@594 17
bos@594 18 image-web := \
bos@594 19 $(image-dot:%.dot=$(obj-web-read)/%.png) \
bos@594 20 $(image-svg:%.svg=$(obj-web-read)/%.png) \
bos@595 21 $(image-oth:%=$(obj-web-read)/%)
bos@213 22
bos@580 23 example-sources-by-name := \
bos@124 24 backout \
bos@131 25 bisect \
bos@179 26 branching \
bos@202 27 branch-named \
bos@198 28 branch-repo \
bos@133 29 cmdref \
bos@117 30 daily.copy \
bos@86 31 daily.files \
bos@118 32 daily.rename \
bos@122 33 daily.revert \
bos@226 34 extdiff \
bos@133 35 filenames \
bos@86 36 hook.msglen \
bos@86 37 hook.simple \
bos@86 38 hook.ws \
bos@156 39 issue29 \
bos@104 40 mq.guards \
bos@86 41 mq.qinit-help \
bos@86 42 mq.dodiff \
bos@86 43 mq.id \
bos@86 44 mq.tarball \
bos@86 45 mq.tools \
bos@86 46 mq.tutorial \
bos@156 47 rename.divergent \
bos@121 48 rollback \
bos@196 49 tag \
bos@86 50 template.simple \
bos@87 51 template.svnstyle \
bos@103 52 tour \
bos@103 53 tour-merge-conflict
bos@4 54
bos@580 55 example-sources := \
bos@580 56 $(example-sources-by-name:%=examples/%) \
bos@580 57 $(wildcard examples/ch*/*)
bos@580 58
bos@575 59 extras-web-base := \
bos@575 60 $(obj-web)/index.html \
bos@575 61 $(obj-web)/robots.txt \
bos@575 62 $(obj-websup)/form-min.js \
bos@575 63 $(obj-websup)/form.js \
bos@575 64 $(obj-websup)/hsbook.js \
bos@575 65 $(obj-websup)/jquery-min.js \
bos@575 66 $(obj-websup)/jquery.js \
bos@575 67 $(obj-websup)/styles.css
bos@575 68
bos@575 69 extras-web := $(extras-web-base) $(extras-web-base:%=%.gz)
bos@575 70
bos@558 71 xsltproc := xsltproc
bos@558 72 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
bos@558 73
bos@558 74 xmllint := xmllint
bos@558 75 xmllint-opts := --noout --nonet --valid
bos@558 76
bos@558 77 system-xsl-dir := $(firstword $(wildcard \
bos@558 78 /usr/share/sgml/docbook/xsl-stylesheets \
bos@558 79 /usr/share/xml/docbook/stylesheet/nwalsh \
bos@558 80 ))
bos@558 81
bos@558 82 # Bletcherousness.
bos@558 83
bos@558 84 ifneq ($(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*),)
bos@558 85 dtd-dir := $(wildcard /usr/share/sgml/docbook/xml-dtd-4.4-*)
bos@558 86 else
bos@558 87 ifneq ($(wildcard /usr/share/xml/docbook/schema/dtd/4.4),)
bos@558 88 dtd-dir := $(wildcard /usr/share/xml/docbook/schema/dtd/4.4)
bos@558 89 else
bos@558 90 $(error Do not know where to look for DocBook XML 4.4 DTD)
bos@558 91 endif
bos@558 92 endif
bos@558 93
bos@558 94 ifeq ($(system-xsl-dir),)
bos@558 95 $(error add a suitable directory to system-xsl-dir)
bos@558 96 endif
bos@558 97
bos@172 98 example-prereqs := \
bos@172 99 /usr/bin/merge
bos@172 100
bos@157 101 dist-sources := \
bos@159 102 ../html/hgicon.png \
bos@157 103 ../html/index.html.var \
bos@157 104 ../html/index.en.html
bos@157 105
bos@177 106 hg = $(shell which hg)
bos@177 107
bos@269 108 hg-id = $(shell hg parents --template '{node|short}, dated {date|isodate},\n')
bos@177 109
bos@177 110 hg-version = $(shell hg version -q | \
bos@242 111 sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
bos@177 112
bos@613 113 all: web complete.xml
bos@149 114
dongsheng@654 115 ../stylesheets/system-xsl: $(system-xsl-dir)
bos@558 116 ln -s $< $@
bos@558 117
dongsheng@654 118 web: ../stylesheets/system-xsl websup html
bos@575 119
bos@594 120 html: $(obj-web-read)/index.html
bos@594 121
bos@599 122 ../web/index-read.html.in: ../web/genindex.py $(xml-src-files)
bos@614 123 cd ../web && ./genindex.py
bos@599 124
dongsheng@654 125 $(obj-web-read)/index.html: ../stylesheets/system-xsl .validated-00book.xml ../web/index-read.html.in
dongsheng@654 126 xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../stylesheets/chunk-stylesheet.xsl 00book.xml
bos@599 127 python ../web/texpand.py ../web/index-read.html.in html/read/index.html
bos@594 128 for i in $(obj-web-read)/*.html; do \
bos@575 129 gzip -9 -c $$i > $$i.gz; \
bos@575 130 done
bos@575 131
bos@594 132 websup: $(extras-web) $(image-web)
bos@594 133 mkdir -p $(obj-websup)/figs $(obj-web-read)/figs
dongsheng@654 134 cp ../stylesheets/system-xsl/images/*.png $(obj-websup)/figs
bos@575 135 cp -f ../web/icons/*.png $(obj-websup)/figs
bos@575 136
bos@613 137 complete.xml: .validated-00book.xml
songdongsheng@667 138 $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/dtd-profile.xsl 00book.xml
songdongsheng@667 139
dongsheng@654 140 all-ids.dat: ../stylesheets/all-ids.xsl $(xml-src-files)
dongsheng@654 141 $(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/all-ids.xsl 00book.xml
bos@588 142
bos@575 143 web: websup
bos@558 144
bos@558 145 valid: .validated-00book.xml
bos@558 146
bos@614 147 .validated-00book.xml: $(xml-src-files) examples/.run
bos@558 148 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
bos@558 149 touch $@
bos@558 150
bos@18 151 # Produce 90dpi PNGs for the web.
bos@18 152
bos@594 153 $(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg
bos@594 154 mkdir -p $(dir $@)
hg@307 155 ./fixsvg $<
bos@309 156 inkscape -D -e $@ $<-tmp.svg
bos@309 157 rm $<-tmp.svg
bos@11 158
bos@594 159 $(obj-web-read)/figs/%.png: figs/%.svg fixsvg
bos@594 160 mkdir -p $(dir $@)
bos@594 161 ./fixsvg $<
bos@594 162 inkscape -D -e $@ $<-tmp.svg
bos@594 163 rm $<-tmp.svg
bos@594 164
bos@595 165 $(obj-web-read)/figs/%.gif: figs/%.gif
bos@595 166 cp $< $@
bos@595 167
bos@594 168 $(obj-web-read)/figs/%.png: figs/%.png
bos@594 169 cp $< $@
bos@594 170
bos@594 171 $(obj-web-read)/figs/%.svg: figs/%.dot
bos@594 172 mkdir -p $(dir $@)
bos@124 173 dot -Tsvg -o $@ $<
bos@124 174
bos@172 175 examples: $(example-prereqs) examples/.run
bos@4 176
bos@580 177 examples/.run: $(example-sources)
bos@615 178 cd examples && ./run-example -a
bos@45 179
bos@45 180 examples/%.run: examples/% examples/run-example
bos@4 181
bos@571 182 clean:
bos@571 183 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
bos@571 184 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
bos@250 185
bos@571 186 install: html $(dist-sources)
bos@153 187 rm -rf dist
bos@153 188 mkdir -p dist
bos@571 189 cp html/*.{css,html,png} dist
bos@157 190 cp $(dist-sources) dist
bos@153 191
bos@153 192 rsync: install
bos@153 193 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
bos@575 194
bos@575 195 vpath %.css ../web
bos@598 196 vpath %.html.in ../web
bos@575 197 vpath %.js ../web/javascript
bos@575 198
bos@575 199 $(obj-websup)/%.css: %.css
bos@575 200 @mkdir -p $(dir $@)
bos@575 201 cp $< $@
bos@575 202
bos@575 203 $(obj-websup)/%.jpg: %.jpg
bos@575 204 @mkdir -p $(dir $@)
bos@575 205 cp $< $@
bos@575 206
bos@575 207 $(obj-websup)/%.js: %.js
bos@575 208 @mkdir -p $(dir $@)
bos@575 209 cp $< $@
bos@575 210
bos@575 211 $(obj-web)/%: ../web/%
bos@575 212 @mkdir -p $(dir $@)
bos@575 213 cp $< $@
bos@575 214
bos@575 215 $(obj-web)/%.html: %.html.in
bos@575 216 @mkdir -p $(dir $@)
bos@575 217 python ../web/texpand.py $< $@
bos@575 218
bos@575 219 %.gz: %
bos@575 220 gzip -9 -c $< > $@