rev |
line source |
dongsheng@626
|
1 #
|
dongsheng@626
|
2 # Makefile for the hgbook, top-level
|
dongsheng@626
|
3 #
|
songdongsheng@657
|
4 include Makefile.vars
|
dongsheng@626
|
5
|
dongsheng@661
|
6 FORMATS=html html-single pdf epub
|
dongsheng@626
|
7
|
dongsheng@626
|
8 PO_LANGUAGES := zh
|
dongsheng@626
|
9 DBK_LANGUAGES := en
|
dongsheng@626
|
10 LANGUAGES := $(DBK_LANGUAGES) $(PO_LANGUAGES)
|
dongsheng@626
|
11
|
songdongsheng@657
|
12 UPDATEPO = PERLLIB=$(PO4A_LIB) $(PO4A_HOME)/po4a-updatepo -M UTF-8 \
|
dongsheng@661
|
13 -f docbook -o doctype=docbook -o includeexternal \
|
dongsheng@661
|
14 -o nodefault="<programlisting> <screen>" \
|
dongsheng@661
|
15 -o untranslated="<programlisting> <screen>"
|
songdongsheng@657
|
16 TRANSLATE = PERLLIB=$(PO4A_LIB) $(PO4A_HOME)/po4a-translate -M UTF-8 \
|
songdongsheng@668
|
17 -f docbook -o doctype=docbook -o includeexternal \
|
songdongsheng@668
|
18 -o nodefault="<programlisting> <screen>" \
|
songdongsheng@668
|
19 -o untranslated="<programlisting> <screen>" \
|
dongsheng@626
|
20 -k 0
|
dongsheng@626
|
21
|
dongsheng@626
|
22 #rev_id = $(shell hg parents --template '{node|short} ({date|isodate})')
|
dongsheng@626
|
23 rev_id = $(shell hg parents --template '{node|short} ({date|shortdate})')
|
dongsheng@626
|
24
|
dongsheng@626
|
25 images := \
|
dongsheng@654
|
26 en/figs/feature-branches.png \
|
dongsheng@654
|
27 en/figs/filelog.png \
|
dongsheng@654
|
28 en/figs/metadata.png \
|
dongsheng@654
|
29 en/figs/mq-stack.png \
|
dongsheng@654
|
30 en/figs/revlog.png \
|
dongsheng@654
|
31 en/figs/snapshot.png \
|
dongsheng@654
|
32 en/figs/tour-history.png \
|
dongsheng@654
|
33 en/figs/tour-merge-conflict.png \
|
dongsheng@654
|
34 en/figs/tour-merge-merge.png \
|
dongsheng@654
|
35 en/figs/tour-merge-pull.png \
|
dongsheng@654
|
36 en/figs/tour-merge-sep-repos.png \
|
dongsheng@654
|
37 en/figs/undo-manual-merge.png \
|
dongsheng@654
|
38 en/figs/undo-manual.png \
|
dongsheng@654
|
39 en/figs/undo-non-tip.png \
|
dongsheng@654
|
40 en/figs/undo-simple.png \
|
dongsheng@654
|
41 en/figs/wdir-after-commit.png \
|
dongsheng@654
|
42 en/figs/wdir-branch.png \
|
dongsheng@654
|
43 en/figs/wdir-merge.png \
|
dongsheng@654
|
44 en/figs/wdir.png \
|
dongsheng@654
|
45 en/figs/wdir-pre-branch.png
|
dongsheng@626
|
46
|
dongsheng@626
|
47 help:
|
dongsheng@661
|
48 @echo " make epub [LINGUA=en|zh|...]"
|
dongsheng@626
|
49 @echo " make html [LINGUA=en|zh|...]"
|
dongsheng@626
|
50 @echo " make html-single [LINGUA=en|zh|...]"
|
dongsheng@626
|
51 @echo " make pdf [LINGUA=en|zh|...]"
|
dongsheng@626
|
52 @echo " make validate [LINGUA=en|zh|...] # always before commit!"
|
dongsheng@626
|
53 @echo " make tidypo [LINGUA=zh|...] # always before commit!"
|
dongsheng@626
|
54 @echo " make updatepo [LINGUA=zh|...] # update po files."
|
dongsheng@626
|
55 @echo " make all [LINGUA=en|zh|...]"
|
dongsheng@626
|
56 @echo " make stat # print statistics about po files."
|
dongsheng@626
|
57 @echo " make clean # Remove the build files."
|
dongsheng@626
|
58
|
dongsheng@626
|
59 clean:
|
dongsheng@654
|
60 @rm -fr build po/*.mo hello en/hello en/html en/.validated-00book.xml en/examples/.run en/examples/results \
|
dongsheng@654
|
61 stylesheets/system-xsl en/figs/*-tmp.svg \
|
dongsheng@654
|
62 en/figs/feature-branches.png \
|
dongsheng@654
|
63 en/figs/filelog.png \
|
dongsheng@654
|
64 en/figs/feature-branches.png \
|
dongsheng@654
|
65 en/figs/filelog.png \
|
dongsheng@654
|
66 en/figs/metadata.png \
|
dongsheng@654
|
67 en/figs/mq-stack.png \
|
dongsheng@654
|
68 en/figs/revlog.png \
|
dongsheng@654
|
69 en/figs/snapshot.png \
|
dongsheng@654
|
70 en/figs/tour-history.png \
|
dongsheng@654
|
71 en/figs/tour-merge-conflict.png \
|
dongsheng@654
|
72 en/figs/tour-merge-merge.png \
|
dongsheng@654
|
73 en/figs/tour-merge-pull.png \
|
dongsheng@654
|
74 en/figs/tour-merge-sep-repos.png \
|
dongsheng@654
|
75 en/figs/undo-manual-merge.png \
|
dongsheng@654
|
76 en/figs/undo-manual.png \
|
dongsheng@654
|
77 en/figs/undo-non-tip.png \
|
dongsheng@654
|
78 en/figs/undo-simple.png \
|
dongsheng@654
|
79 en/figs/wdir-after-commit.png \
|
dongsheng@654
|
80 en/figs/wdir-branch.png \
|
dongsheng@654
|
81 en/figs/wdir-merge.png \
|
dongsheng@654
|
82 en/figs/wdir-pre-branch.png \
|
dongsheng@654
|
83 en/figs/wdir.png
|
dongsheng@626
|
84
|
dongsheng@626
|
85 all:
|
dongsheng@626
|
86 ifdef LINGUA
|
dongsheng@626
|
87 for f in $(FORMATS); do \
|
dongsheng@626
|
88 $(MAKE) LINGUA=$(LINGUA) $$f; \
|
dongsheng@626
|
89 done
|
dongsheng@626
|
90 else
|
dongsheng@626
|
91 for l in $(LANGUAGES); do \
|
dongsheng@626
|
92 for f in $(FORMATS); do \
|
dongsheng@626
|
93 $(MAKE) LINGUA=$$l $$f; \
|
dongsheng@626
|
94 done; \
|
dongsheng@626
|
95 done
|
dongsheng@626
|
96 endif
|
dongsheng@626
|
97
|
dongsheng@626
|
98 stat:
|
dongsheng@626
|
99 @( \
|
dongsheng@626
|
100 LANG=C; export LANG; cd po; \
|
dongsheng@626
|
101 for f in *.po; do \
|
dongsheng@626
|
102 printf "%s\t" $$f; \
|
dongsheng@626
|
103 msgfmt --statistics -c $$f; \
|
dongsheng@626
|
104 done; \
|
dongsheng@626
|
105 )
|
dongsheng@626
|
106
|
dongsheng@626
|
107 tidypo:
|
dongsheng@626
|
108 ifdef LINGUA
|
dongsheng@626
|
109 msgcat --sort-by-file --width=80 po/$(LINGUA).po > po/$(LINGUA).tmp && \
|
dongsheng@626
|
110 mv po/$(LINGUA).tmp po/$(LINGUA).po;
|
dongsheng@626
|
111 else
|
dongsheng@626
|
112 for po in $(wildcard po/*.po); do \
|
dongsheng@626
|
113 msgcat --sort-by-file --width=80 $$po > $$po.tmp && mv $$po.tmp $$po; \
|
dongsheng@626
|
114 done
|
dongsheng@626
|
115 endif
|
dongsheng@626
|
116
|
dongsheng@626
|
117 ifndef LINGUA
|
dongsheng@626
|
118 updatepo:
|
dongsheng@626
|
119 for l in $(PO_LANGUAGES); do \
|
dongsheng@626
|
120 $(MAKE) $@ LINGUA=$$l; \
|
dongsheng@626
|
121 done
|
dongsheng@626
|
122 else
|
dongsheng@626
|
123 updatepo:
|
dongsheng@626
|
124 ifneq "$(findstring $(LINGUA),$(PO_LANGUAGES))" ""
|
dongsheng@661
|
125 (cd po; \
|
dongsheng@661
|
126 $(UPDATEPO) -m ../en/00book.xml -p $(LINGUA).po; \
|
dongsheng@661
|
127 )
|
dongsheng@626
|
128 $(MAKE) tidypo LINGUA=$(LINGUA)
|
dongsheng@626
|
129 endif
|
dongsheng@626
|
130 endif
|
dongsheng@626
|
131
|
dongsheng@626
|
132 ifndef LINGUA
|
dongsheng@626
|
133 validate:
|
dongsheng@626
|
134 for l in $(LANGUAGES); do \
|
dongsheng@626
|
135 $(MAKE) $@ LINGUA=$$l; \
|
dongsheng@626
|
136 done
|
dongsheng@626
|
137 else
|
dongsheng@626
|
138 validate: build/$(LINGUA)/source/hgbook.xml
|
dongsheng@626
|
139 xmllint --nonet --noout --postvalid --xinclude $<
|
dongsheng@626
|
140
|
dongsheng@626
|
141 ifneq "$(findstring $(LINGUA),$(DBK_LANGUAGES))" ""
|
dongsheng@654
|
142 $(LINGUA)/examples/.run:
|
dongsheng@654
|
143 (cd $(LINGUA)/examples; ./run-example -v -a)
|
dongsheng@654
|
144
|
songdongsheng@668
|
145 build/$(LINGUA)/source/hgbook.xml: $(wildcard $(LINGUA)/*.xml) $(images) $(LINGUA)/examples/.run
|
dongsheng@654
|
146 mkdir -p build/$(LINGUA)/source/figs
|
dongsheng@654
|
147 cp $(LINGUA)/figs/*.png build/$(LINGUA)/source/figs
|
dongsheng@661
|
148 cp stylesheets/hgbook.css build/$(LINGUA)/source
|
dongsheng@654
|
149 (cd $(LINGUA); xmllint --nonet --noent --xinclude --postvalid --output ../$@.tmp 00book.xml)
|
dongsheng@626
|
150 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@
|
dongsheng@626
|
151 else
|
dongsheng@654
|
152 en/examples/.run:
|
dongsheng@654
|
153 (cd en/examples; ./run-example -v -a)
|
dongsheng@654
|
154
|
dongsheng@654
|
155 build/en/source/hgbook.xml:
|
dongsheng@654
|
156 ${MAKE} LINGUA=en $@
|
dongsheng@654
|
157
|
songdongsheng@668
|
158 build/$(LINGUA)/source/hgbook.xml: $(wildcard en/*.xml) po/$(LINGUA).po $(images)
|
dongsheng@654
|
159 mkdir -p build/$(LINGUA)/source/figs
|
songdongsheng@657
|
160 cp en/figs/*.png build/$(LINGUA)/source/figs
|
dongsheng@661
|
161 cp stylesheets/hgbook.css build/$(LINGUA)/source
|
songdongsheng@668
|
162 $(TRANSLATE) -m en/00book.xml -p po/$(LINGUA).po -l en/hgbook.xml.$(LINGUA)
|
songdongsheng@668
|
163 xmllint --nonet --noent --xinclude --postvalid --output $@.tmp en/hgbook.xml.$(LINGUA)
|
dongsheng@626
|
164 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@
|
songdongsheng@668
|
165 mv en/hgbook.xml.$(LINGUA) build/$(LINGUA)/source
|
dongsheng@626
|
166 endif
|
dongsheng@626
|
167
|
dongsheng@626
|
168 endif
|
dongsheng@626
|
169
|
dongsheng@626
|
170 ifndef LINGUA
|
dongsheng@661
|
171 epub:
|
dongsheng@661
|
172 for l in $(LANGUAGES); do \
|
dongsheng@661
|
173 $(MAKE) $@ LINGUA=$$l; \
|
dongsheng@661
|
174 done
|
dongsheng@661
|
175 else
|
dongsheng@661
|
176 epub: build/$(LINGUA)/epub/hgbook.epub
|
dongsheng@661
|
177
|
dongsheng@661
|
178 build/$(LINGUA)/epub/hgbook.epub: build/$(LINGUA)/source/hgbook.xml
|
dongsheng@661
|
179 mkdir -p build/$(LINGUA)/epub
|
dongsheng@661
|
180 (cd build/$(LINGUA)/source; $(DB2EPUB) -c hgbook.css -v hgbook.xml; mv hgbook.epub ../epub)
|
dongsheng@661
|
181 endif
|
dongsheng@661
|
182
|
dongsheng@661
|
183 ifndef LINGUA
|
dongsheng@626
|
184 html:
|
dongsheng@626
|
185 for l in $(LANGUAGES); do \
|
dongsheng@626
|
186 $(MAKE) $@ LINGUA=$$l; \
|
dongsheng@626
|
187 done
|
dongsheng@626
|
188 else
|
dongsheng@626
|
189 html: build/$(LINGUA)/html/index.html
|
dongsheng@626
|
190
|
dongsheng@629
|
191 build/$(LINGUA)/html/index.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html.xsl stylesheets/$(LINGUA)/html.xsl
|
dongsheng@654
|
192 mkdir -p build/$(LINGUA)/html/figs
|
dongsheng@654
|
193 cp en/figs/*.png build/$(LINGUA)/html/figs
|
dongsheng@629
|
194 cp stylesheets/hgbook.css build/$(LINGUA)/html
|
dongsheng@626
|
195 xsltproc --output build/$(LINGUA)/html/ \
|
dongsheng@629
|
196 stylesheets/$(LINGUA)/html.xsl build/$(LINGUA)/source/hgbook.xml
|
dongsheng@626
|
197 endif
|
dongsheng@626
|
198
|
dongsheng@626
|
199 ifndef LINGUA
|
dongsheng@626
|
200 html-single:
|
dongsheng@626
|
201 for l in $(LANGUAGES); do \
|
dongsheng@626
|
202 $(MAKE) $@ LINGUA=$$l; \
|
dongsheng@626
|
203 done
|
dongsheng@626
|
204 else
|
dongsheng@626
|
205 html-single: build/$(LINGUA)/html-single/hgbook.html
|
dongsheng@626
|
206
|
dongsheng@629
|
207 build/$(LINGUA)/html-single/hgbook.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html-single.xsl stylesheets/$(LINGUA)/html-single.xsl
|
dongsheng@654
|
208 mkdir -p build/$(LINGUA)/html-single/figs
|
dongsheng@654
|
209 cp en/figs/*.png build/$(LINGUA)/html-single/figs
|
dongsheng@629
|
210 cp stylesheets/hgbook.css build/$(LINGUA)/html-single
|
dongsheng@626
|
211 xsltproc --output build/$(LINGUA)/html-single/hgbook.html \
|
dongsheng@629
|
212 stylesheets/$(LINGUA)/html-single.xsl build/$(LINGUA)/source/hgbook.xml
|
dongsheng@626
|
213 endif
|
dongsheng@626
|
214
|
dongsheng@626
|
215 ifndef LINGUA
|
dongsheng@626
|
216 pdf:
|
dongsheng@626
|
217 for l in $(LANGUAGES); do \
|
dongsheng@626
|
218 $(MAKE) $@ LINGUA=$$l; \
|
dongsheng@626
|
219 done
|
dongsheng@626
|
220 else
|
dongsheng@626
|
221 pdf: build/$(LINGUA)/pdf/hgbook.pdf
|
dongsheng@626
|
222
|
dongsheng@629
|
223 build/$(LINGUA)/pdf/hgbook.pdf: build/$(LINGUA)/source/hgbook.xml stylesheets/fo.xsl stylesheets/$(LINGUA)/fo.xsl
|
dongsheng@626
|
224 mkdir -p build/$(LINGUA)/pdf
|
songdongsheng@668
|
225 java -classpath $(JAVA_LIB)/saxon65.jar:$(JAVA_LIB)/saxon65-dbxsl.jar:$(JAVA_LIB)/xml-commons-resolver-1.2.jar:$(JAVA_LIB) \
|
dongsheng@626
|
226 com.icl.saxon.StyleSheet \
|
dongsheng@626
|
227 -x org.apache.xml.resolver.tools.ResolvingXMLReader \
|
dongsheng@626
|
228 -y org.apache.xml.resolver.tools.ResolvingXMLReader \
|
dongsheng@626
|
229 -r org.apache.xml.resolver.tools.CatalogResolver \
|
dongsheng@626
|
230 -o build/$(LINGUA)/source/hgbook.fo \
|
dongsheng@626
|
231 build/$(LINGUA)/source/hgbook.xml \
|
dongsheng@629
|
232 stylesheets/$(LINGUA)/fo.xsl \
|
dongsheng@626
|
233 fop1.extensions=1
|
dongsheng@626
|
234
|
dongsheng@659
|
235 (cd build/$(LINGUA)/source && $(FOP_HOME)/fop.sh -c $(FOP_HOME)/conf/userconfig.xml hgbook.fo ../pdf/hgbook.pdf)
|
dongsheng@626
|
236 endif
|
dongsheng@626
|
237
|
dongsheng@654
|
238 en/figs/%.png: en/figs/%.svg en/fixsvg
|
dongsheng@633
|
239 en/fixsvg $<
|
dongsheng@633
|
240 inkscape -D -d 120 -e $@ $<-tmp.svg
|
dongsheng@626
|
241
|
dongsheng@654
|
242 en/figs/%.svg: en/figs/%.dot
|
dongsheng@626
|
243 dot -Tsvg -o $@ $<
|