hgbook

annotate en/Makefile @ 602:de5b1753e865

Merge
author Bryan O'Sullivan <bos@serpentine.com>
date Fri Mar 27 11:55:18 2009 -0500 (2009-03-27)
parents 7893b3824715
children f107ab150809 1c13ed2130a7
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@575 113 all: web
bos@149 114
bos@558 115 ../xsl/system-xsl: $(system-xsl-dir)
bos@558 116 ln -s $< $@
bos@558 117
bos@581 118 web: ../xsl/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@599 123 $<
bos@599 124
bos@599 125 $(obj-web-read)/index.html: ../xsl/system-xsl .validated-00book.xml ../web/index-read.html.in
bos@594 126 xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../xsl/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
bos@575 134 cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs
bos@575 135 cp -f ../web/icons/*.png $(obj-websup)/figs
bos@575 136
bos@588 137 all-ids.dat: ../xsl/all-ids.xsl $(xml-src-files)
bos@588 138 $(xsltproc) $(xsltproc-opts) -o $@ ../xsl/all-ids.xsl 00book.xml
bos@588 139
bos@575 140 web: websup
bos@558 141
bos@558 142 valid: .validated-00book.xml
bos@558 143
bos@558 144 .validated-00book.xml: $(xml-src-files)
bos@558 145 $(xmllint) --path '$(dtd-dir):$(xml-path)' $(xmllint-opts) $<
bos@558 146 touch $@
bos@558 147
bos@18 148 # Produce 90dpi PNGs for the web.
bos@18 149
bos@594 150 $(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg
bos@594 151 mkdir -p $(dir $@)
hg@307 152 ./fixsvg $<
bos@309 153 inkscape -D -e $@ $<-tmp.svg
bos@309 154 rm $<-tmp.svg
bos@11 155
bos@594 156 $(obj-web-read)/figs/%.png: figs/%.svg fixsvg
bos@594 157 mkdir -p $(dir $@)
bos@594 158 ./fixsvg $<
bos@594 159 inkscape -D -e $@ $<-tmp.svg
bos@594 160 rm $<-tmp.svg
bos@594 161
bos@595 162 $(obj-web-read)/figs/%.gif: figs/%.gif
bos@595 163 cp $< $@
bos@595 164
bos@594 165 $(obj-web-read)/figs/%.png: figs/%.png
bos@594 166 cp $< $@
bos@594 167
bos@594 168 $(obj-web-read)/figs/%.svg: figs/%.dot
bos@594 169 mkdir -p $(dir $@)
bos@124 170 dot -Tsvg -o $@ $<
bos@124 171
bos@172 172 examples: $(example-prereqs) examples/.run
bos@4 173
bos@580 174 examples/.run: $(example-sources)
bos@580 175 cd examples && ./run-example
bos@45 176
bos@45 177 examples/%.run: examples/% examples/run-example
bos@4 178
bos@571 179 clean:
bos@571 180 -rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \
bos@571 181 $(image-svg:%.svg=%.png) examples/*.{lxo,run} examples/.run
bos@250 182
bos@571 183 install: html $(dist-sources)
bos@153 184 rm -rf dist
bos@153 185 mkdir -p dist
bos@571 186 cp html/*.{css,html,png} dist
bos@157 187 cp $(dist-sources) dist
bos@153 188
bos@153 189 rsync: install
bos@153 190 rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
bos@575 191
bos@575 192 vpath %.css ../web
bos@598 193 vpath %.html.in ../web
bos@575 194 vpath %.js ../web/javascript
bos@575 195
bos@575 196 $(obj-websup)/%.css: %.css
bos@575 197 @mkdir -p $(dir $@)
bos@575 198 cp $< $@
bos@575 199
bos@575 200 $(obj-websup)/%.jpg: %.jpg
bos@575 201 @mkdir -p $(dir $@)
bos@575 202 cp $< $@
bos@575 203
bos@575 204 $(obj-websup)/%.js: %.js
bos@575 205 @mkdir -p $(dir $@)
bos@575 206 cp $< $@
bos@575 207
bos@575 208 $(obj-web)/%: ../web/%
bos@575 209 @mkdir -p $(dir $@)
bos@575 210 cp $< $@
bos@575 211
bos@575 212 $(obj-web)/%.html: %.html.in
bos@575 213 @mkdir -p $(dir $@)
bos@575 214 python ../web/texpand.py $< $@
bos@575 215
bos@575 216 %.gz: %
bos@575 217 gzip -9 -c $< > $@