comparison Makefile @ 753:1c13ed2130a7

Merge with http://hg.serpentine.com/mercurial/book
author Dongsheng Song <dongsheng.song@gmail.com>
date Mon, 30 Mar 2009 16:23:33 +0800
parents 74da9b315396
children 1e020cb7d417
comparison
equal deleted inserted replaced
752:6b1577ef5135 753:1c13ed2130a7
18 18
19 #rev_id = $(shell hg parents --template '{node|short} ({date|isodate})') 19 #rev_id = $(shell hg parents --template '{node|short} ({date|isodate})')
20 rev_id = $(shell hg parents --template '{node|short} ({date|shortdate})') 20 rev_id = $(shell hg parents --template '{node|short} ({date|shortdate})')
21 21
22 images := \ 22 images := \
23 en/images/feature-branches.png \ 23 en/figs/feature-branches.png \
24 en/images/filelog.png \ 24 en/figs/filelog.png \
25 en/images/metadata.png \ 25 en/figs/metadata.png \
26 en/images/mq-stack.png \ 26 en/figs/mq-stack.png \
27 en/images/revlog.png \ 27 en/figs/revlog.png \
28 en/images/snapshot.png \ 28 en/figs/snapshot.png \
29 en/images/tour-history.png \ 29 en/figs/tour-history.png \
30 en/images/tour-merge-conflict.png \ 30 en/figs/tour-merge-conflict.png \
31 en/images/tour-merge-merge.png \ 31 en/figs/tour-merge-merge.png \
32 en/images/tour-merge-pull.png \ 32 en/figs/tour-merge-pull.png \
33 en/images/tour-merge-sep-repos.png \ 33 en/figs/tour-merge-sep-repos.png \
34 en/images/undo-manual-merge.png \ 34 en/figs/undo-manual-merge.png \
35 en/images/undo-manual.png \ 35 en/figs/undo-manual.png \
36 en/images/undo-non-tip.png \ 36 en/figs/undo-non-tip.png \
37 en/images/undo-simple.png \ 37 en/figs/undo-simple.png \
38 en/images/wdir-after-commit.png \ 38 en/figs/wdir-after-commit.png \
39 en/images/wdir-branch.png \ 39 en/figs/wdir-branch.png \
40 en/images/wdir-merge.png \ 40 en/figs/wdir-merge.png \
41 en/images/wdir.png \ 41 en/figs/wdir.png \
42 en/images/wdir-pre-branch.png 42 en/figs/wdir-pre-branch.png
43 43
44 help: 44 help:
45 @echo " make html [LINGUA=en|zh|...]" 45 @echo " make html [LINGUA=en|zh|...]"
46 @echo " make html-single [LINGUA=en|zh|...]" 46 @echo " make html-single [LINGUA=en|zh|...]"
47 @echo " make pdf [LINGUA=en|zh|...]" 47 @echo " make pdf [LINGUA=en|zh|...]"
51 @echo " make all [LINGUA=en|zh|...]" 51 @echo " make all [LINGUA=en|zh|...]"
52 @echo " make stat # print statistics about po files." 52 @echo " make stat # print statistics about po files."
53 @echo " make clean # Remove the build files." 53 @echo " make clean # Remove the build files."
54 54
55 clean: 55 clean:
56 @rm -fr build po/*.mo hello en/hello en/html en/.validated-00book.xml \ 56 @rm -fr build po/*.mo hello en/hello en/html en/.validated-00book.xml en/examples/.run en/examples/results \
57 stylesheets/system-xsl en/images/*-tmp.svg \ 57 stylesheets/system-xsl en/figs/*-tmp.svg \
58 en/images/feature-branches.png \ 58 en/figs/feature-branches.png \
59 en/images/filelog.png \ 59 en/figs/filelog.png \
60 en/images/feature-branches.png \ 60 en/figs/feature-branches.png \
61 en/images/filelog.png \ 61 en/figs/filelog.png \
62 en/images/metadata.png \ 62 en/figs/metadata.png \
63 en/images/mq-stack.png \ 63 en/figs/mq-stack.png \
64 en/images/revlog.png \ 64 en/figs/revlog.png \
65 en/images/snapshot.png \ 65 en/figs/snapshot.png \
66 en/images/tour-history.png \ 66 en/figs/tour-history.png \
67 en/images/tour-merge-conflict.png \ 67 en/figs/tour-merge-conflict.png \
68 en/images/tour-merge-merge.png \ 68 en/figs/tour-merge-merge.png \
69 en/images/tour-merge-pull.png \ 69 en/figs/tour-merge-pull.png \
70 en/images/tour-merge-sep-repos.png \ 70 en/figs/tour-merge-sep-repos.png \
71 en/images/undo-manual-merge.png \ 71 en/figs/undo-manual-merge.png \
72 en/images/undo-manual.png \ 72 en/figs/undo-manual.png \
73 en/images/undo-non-tip.png \ 73 en/figs/undo-non-tip.png \
74 en/images/undo-simple.png \ 74 en/figs/undo-simple.png \
75 en/images/wdir-after-commit.png \ 75 en/figs/wdir-after-commit.png \
76 en/images/wdir-branch.png \ 76 en/figs/wdir-branch.png \
77 en/images/wdir-merge.png \ 77 en/figs/wdir-merge.png \
78 en/images/wdir-pre-branch.png \ 78 en/figs/wdir-pre-branch.png \
79 en/images/wdir.png 79 en/figs/wdir.png
80 80
81 all: 81 all:
82 ifdef LINGUA 82 ifdef LINGUA
83 for f in $(FORMATS); do \ 83 for f in $(FORMATS); do \
84 $(MAKE) LINGUA=$(LINGUA) $$f; \ 84 $(MAKE) LINGUA=$(LINGUA) $$f; \
131 else 131 else
132 validate: build/$(LINGUA)/source/hgbook.xml 132 validate: build/$(LINGUA)/source/hgbook.xml
133 xmllint --nonet --noout --postvalid --xinclude $< 133 xmllint --nonet --noout --postvalid --xinclude $<
134 134
135 ifneq "$(findstring $(LINGUA),$(DBK_LANGUAGES))" "" 135 ifneq "$(findstring $(LINGUA),$(DBK_LANGUAGES))" ""
136 build/$(LINGUA)/source/hgbook.xml: $(wildcard $(LINGUA)/*.xml) $(images) 136 $(LINGUA)/examples/.run:
137 mkdir -p build/$(LINGUA)/source 137 (cd $(LINGUA)/examples; ./run-example -v -a)
138 cp -r $(LINGUA)/* build/$(LINGUA)/source 138
139 xmllint --nonet --noent --xinclude --postvalid --output $@.tmp $(LINGUA)/00book.xml 139 build/$(LINGUA)/source/hgbook.xml: $(wildcard $(LINGUA)/*.xml) $(images) $(LINGUA)/examples/.run $(images)
140 mkdir -p build/$(LINGUA)/source/figs
141 cp $(LINGUA)/figs/*.png build/$(LINGUA)/source/figs
142 (cd $(LINGUA); xmllint --nonet --noent --xinclude --postvalid --output ../$@.tmp 00book.xml)
140 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@ 143 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@
141 else 144 else
142 build/$(LINGUA)/source/hgbook.xml: $(wildcard en/*.xml) po/$(LINGUA).po $(images) 145 en/examples/.run:
143 mkdir -p build/$(LINGUA)/source 146 (cd en/examples; ./run-example -v -a)
144 cp -r en/images build/$(LINGUA)/source 147
145 cp -r en/examples build/$(LINGUA)/source 148 build/en/source/hgbook.xml:
146 cp en/book-shortcuts.xml build/$(LINGUA)/source 149 ${MAKE} LINGUA=en $@
147 for f in en/*.xml; do \ 150
148 if [ $$f != "en/book-shortcuts.xml" ]; then \ 151 build/$(LINGUA)/source/hgbook.xml: build/en/source/hgbook.xml po/$(LINGUA).po $(images)
149 $(TRANSLATE) -m $$f -p po/$(LINGUA).po -l build/$(LINGUA)/source/`basename $$f`; \ 152 mkdir -p build/$(LINGUA)/source/figs
150 fi \ 153 $(TRANSLATE) -m build/en/source/hgbook.xml -p po/$(LINGUA).po -l $@.tmp
151 done
152 xmllint --nonet --noent --xinclude --postvalid --output $@.tmp build/$(LINGUA)/source/00book.xml
153 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@ 154 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@
154 endif 155 endif
155 156
156 endif 157 endif
157 158
162 done 163 done
163 else 164 else
164 html: build/$(LINGUA)/html/index.html 165 html: build/$(LINGUA)/html/index.html
165 166
166 build/$(LINGUA)/html/index.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html.xsl stylesheets/$(LINGUA)/html.xsl 167 build/$(LINGUA)/html/index.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html.xsl stylesheets/$(LINGUA)/html.xsl
167 mkdir -p build/$(LINGUA)/html/images 168 mkdir -p build/$(LINGUA)/html/figs
168 cp en/images/*.png build/$(LINGUA)/html/images 169 cp en/figs/*.png build/$(LINGUA)/html/figs
169 cp stylesheets/hgbook.css build/$(LINGUA)/html 170 cp stylesheets/hgbook.css build/$(LINGUA)/html
170 xsltproc --output build/$(LINGUA)/html/ \ 171 xsltproc --output build/$(LINGUA)/html/ \
171 stylesheets/$(LINGUA)/html.xsl build/$(LINGUA)/source/hgbook.xml 172 stylesheets/$(LINGUA)/html.xsl build/$(LINGUA)/source/hgbook.xml
172 endif 173 endif
173 174
178 done 179 done
179 else 180 else
180 html-single: build/$(LINGUA)/html-single/hgbook.html 181 html-single: build/$(LINGUA)/html-single/hgbook.html
181 182
182 build/$(LINGUA)/html-single/hgbook.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html-single.xsl stylesheets/$(LINGUA)/html-single.xsl 183 build/$(LINGUA)/html-single/hgbook.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html-single.xsl stylesheets/$(LINGUA)/html-single.xsl
183 mkdir -p build/$(LINGUA)/html-single/images 184 mkdir -p build/$(LINGUA)/html-single/figs
184 cp en/images/*.png build/$(LINGUA)/html-single/images 185 cp en/figs/*.png build/$(LINGUA)/html-single/figs
185 cp stylesheets/hgbook.css build/$(LINGUA)/html-single 186 cp stylesheets/hgbook.css build/$(LINGUA)/html-single
186 xsltproc --output build/$(LINGUA)/html-single/hgbook.html \ 187 xsltproc --output build/$(LINGUA)/html-single/hgbook.html \
187 stylesheets/$(LINGUA)/html-single.xsl build/$(LINGUA)/source/hgbook.xml 188 stylesheets/$(LINGUA)/html-single.xsl build/$(LINGUA)/source/hgbook.xml
188 endif 189 endif
189 190
208 fop1.extensions=1 209 fop1.extensions=1
209 210
210 (cd build/$(LINGUA)/source && ../../../tools/fop/fop.sh hgbook.fo ../pdf/hgbook.pdf) 211 (cd build/$(LINGUA)/source && ../../../tools/fop/fop.sh hgbook.fo ../pdf/hgbook.pdf)
211 endif 212 endif
212 213
213 en/images/%.png: en/images/%.svg en/fixsvg 214 en/figs/%.png: en/figs/%.svg en/fixsvg
214 en/fixsvg $< 215 en/fixsvg $<
215 inkscape -D -d 120 -e $@ $<-tmp.svg 216 inkscape -D -d 120 -e $@ $<-tmp.svg
216 217
217 en/images/%.svg: en/images/%.dot 218 en/figs/%.svg: en/figs/%.dot
218 dot -Tsvg -o $@ $< 219 dot -Tsvg -o $@ $<