hgbook

annotate Makefile @ 890:2887b61fa4fe

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