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