hgbook
annotate Makefile @ 630:ccda4952e5f3
Update Chinese translation
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Thu Mar 12 17:12:18 2009 +0800 (2009-03-12) |
parents | 0e3d8f66bbb7 |
children | 74da9b315396 |
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@626 | 23 en/images/feature-branches.png \ |
dongsheng@626 | 24 en/images/filelog.png \ |
dongsheng@626 | 25 en/images/metadata.png \ |
dongsheng@626 | 26 en/images/mq-stack.png \ |
dongsheng@626 | 27 en/images/revlog.png \ |
dongsheng@626 | 28 en/images/snapshot.png \ |
dongsheng@626 | 29 en/images/tour-history.png \ |
dongsheng@626 | 30 en/images/tour-merge-conflict.png \ |
dongsheng@626 | 31 en/images/tour-merge-merge.png \ |
dongsheng@626 | 32 en/images/tour-merge-pull.png \ |
dongsheng@626 | 33 en/images/tour-merge-sep-repos.png \ |
dongsheng@626 | 34 en/images/undo-manual-merge.png \ |
dongsheng@626 | 35 en/images/undo-manual.png \ |
dongsheng@626 | 36 en/images/undo-non-tip.png \ |
dongsheng@626 | 37 en/images/undo-simple.png \ |
dongsheng@626 | 38 en/images/wdir-after-commit.png \ |
dongsheng@626 | 39 en/images/wdir-branch.png \ |
dongsheng@626 | 40 en/images/wdir-merge.png \ |
dongsheng@626 | 41 en/images/wdir.png \ |
dongsheng@626 | 42 en/images/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@626 | 56 @rm -fr build po/*.mo |
dongsheng@626 | 57 |
dongsheng@626 | 58 all: |
dongsheng@626 | 59 ifdef LINGUA |
dongsheng@626 | 60 for f in $(FORMATS); do \ |
dongsheng@626 | 61 $(MAKE) LINGUA=$(LINGUA) $$f; \ |
dongsheng@626 | 62 done |
dongsheng@626 | 63 else |
dongsheng@626 | 64 for l in $(LANGUAGES); do \ |
dongsheng@626 | 65 for f in $(FORMATS); do \ |
dongsheng@626 | 66 $(MAKE) LINGUA=$$l $$f; \ |
dongsheng@626 | 67 done; \ |
dongsheng@626 | 68 done |
dongsheng@626 | 69 endif |
dongsheng@626 | 70 |
dongsheng@626 | 71 stat: |
dongsheng@626 | 72 @( \ |
dongsheng@626 | 73 LANG=C; export LANG; cd po; \ |
dongsheng@626 | 74 for f in *.po; do \ |
dongsheng@626 | 75 printf "%s\t" $$f; \ |
dongsheng@626 | 76 msgfmt --statistics -c $$f; \ |
dongsheng@626 | 77 done; \ |
dongsheng@626 | 78 ) |
dongsheng@626 | 79 |
dongsheng@626 | 80 tidypo: |
dongsheng@626 | 81 ifdef LINGUA |
dongsheng@626 | 82 msgcat --sort-by-file --width=80 po/$(LINGUA).po > po/$(LINGUA).tmp && \ |
dongsheng@626 | 83 mv po/$(LINGUA).tmp po/$(LINGUA).po; |
dongsheng@626 | 84 else |
dongsheng@626 | 85 for po in $(wildcard po/*.po); do \ |
dongsheng@626 | 86 msgcat --sort-by-file --width=80 $$po > $$po.tmp && mv $$po.tmp $$po; \ |
dongsheng@626 | 87 done |
dongsheng@626 | 88 endif |
dongsheng@626 | 89 |
dongsheng@626 | 90 ifndef LINGUA |
dongsheng@626 | 91 updatepo: |
dongsheng@626 | 92 for l in $(PO_LANGUAGES); do \ |
dongsheng@626 | 93 $(MAKE) $@ LINGUA=$$l; \ |
dongsheng@626 | 94 done |
dongsheng@626 | 95 else |
dongsheng@626 | 96 updatepo: |
dongsheng@626 | 97 ifneq "$(findstring $(LINGUA),$(PO_LANGUAGES))" "" |
dongsheng@626 | 98 (cd po && $(UPDATEPO) -m ../en/00book.xml -p $(LINGUA).po) |
dongsheng@626 | 99 $(MAKE) tidypo LINGUA=$(LINGUA) |
dongsheng@626 | 100 endif |
dongsheng@626 | 101 endif |
dongsheng@626 | 102 |
dongsheng@626 | 103 ifndef LINGUA |
dongsheng@626 | 104 validate: |
dongsheng@626 | 105 for l in $(LANGUAGES); do \ |
dongsheng@626 | 106 $(MAKE) $@ LINGUA=$$l; \ |
dongsheng@626 | 107 done |
dongsheng@626 | 108 else |
dongsheng@626 | 109 validate: build/$(LINGUA)/source/hgbook.xml |
dongsheng@626 | 110 xmllint --nonet --noout --postvalid --xinclude $< |
dongsheng@626 | 111 |
dongsheng@626 | 112 ifneq "$(findstring $(LINGUA),$(DBK_LANGUAGES))" "" |
dongsheng@626 | 113 build/$(LINGUA)/source/hgbook.xml: $(wildcard $(LINGUA)/*.xml) $(images) |
dongsheng@626 | 114 mkdir -p build/$(LINGUA)/source |
dongsheng@626 | 115 cp -r $(LINGUA)/* build/$(LINGUA)/source |
dongsheng@626 | 116 xmllint --nonet --noent --xinclude --postvalid --output $@.tmp $(LINGUA)/00book.xml |
dongsheng@626 | 117 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@ |
dongsheng@626 | 118 else |
dongsheng@626 | 119 build/$(LINGUA)/source/hgbook.xml: $(wildcard en/*.xml) po/$(LINGUA).po $(images) |
dongsheng@626 | 120 mkdir -p build/$(LINGUA)/source |
dongsheng@626 | 121 cp -r en/images build/$(LINGUA)/source |
dongsheng@626 | 122 cp -r en/examples build/$(LINGUA)/source |
dongsheng@626 | 123 cp en/book-shortcuts.xml build/$(LINGUA)/source |
dongsheng@626 | 124 for f in en/*.xml; do \ |
dongsheng@626 | 125 if [ $$f != "en/book-shortcuts.xml" ]; then \ |
dongsheng@626 | 126 $(TRANSLATE) -m $$f -p po/$(LINGUA).po -l build/$(LINGUA)/source/`basename $$f`; \ |
dongsheng@626 | 127 fi \ |
dongsheng@626 | 128 done |
dongsheng@626 | 129 xmllint --nonet --noent --xinclude --postvalid --output $@.tmp build/$(LINGUA)/source/00book.xml |
dongsheng@626 | 130 cat $@.tmp | sed 's/\$$rev_id\$$/${rev_id}/' > $@ |
dongsheng@626 | 131 endif |
dongsheng@626 | 132 |
dongsheng@626 | 133 endif |
dongsheng@626 | 134 |
dongsheng@626 | 135 ifndef LINGUA |
dongsheng@626 | 136 html: |
dongsheng@626 | 137 for l in $(LANGUAGES); do \ |
dongsheng@626 | 138 $(MAKE) $@ LINGUA=$$l; \ |
dongsheng@626 | 139 done |
dongsheng@626 | 140 else |
dongsheng@626 | 141 html: build/$(LINGUA)/html/index.html |
dongsheng@626 | 142 |
dongsheng@629 | 143 build/$(LINGUA)/html/index.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html.xsl stylesheets/$(LINGUA)/html.xsl |
dongsheng@626 | 144 mkdir -p build/$(LINGUA)/html/images |
dongsheng@626 | 145 cp en/images/*.png build/$(LINGUA)/html/images |
dongsheng@629 | 146 cp stylesheets/hgbook.css build/$(LINGUA)/html |
dongsheng@626 | 147 xsltproc --output build/$(LINGUA)/html/ \ |
dongsheng@629 | 148 stylesheets/$(LINGUA)/html.xsl build/$(LINGUA)/source/hgbook.xml |
dongsheng@626 | 149 endif |
dongsheng@626 | 150 |
dongsheng@626 | 151 ifndef LINGUA |
dongsheng@626 | 152 html-single: |
dongsheng@626 | 153 for l in $(LANGUAGES); do \ |
dongsheng@626 | 154 $(MAKE) $@ LINGUA=$$l; \ |
dongsheng@626 | 155 done |
dongsheng@626 | 156 else |
dongsheng@626 | 157 html-single: build/$(LINGUA)/html-single/hgbook.html |
dongsheng@626 | 158 |
dongsheng@629 | 159 build/$(LINGUA)/html-single/hgbook.html: build/$(LINGUA)/source/hgbook.xml stylesheets/html-single.xsl stylesheets/$(LINGUA)/html-single.xsl |
dongsheng@626 | 160 mkdir -p build/$(LINGUA)/html-single/images |
dongsheng@626 | 161 cp en/images/*.png build/$(LINGUA)/html-single/images |
dongsheng@629 | 162 cp stylesheets/hgbook.css build/$(LINGUA)/html-single |
dongsheng@626 | 163 xsltproc --output build/$(LINGUA)/html-single/hgbook.html \ |
dongsheng@629 | 164 stylesheets/$(LINGUA)/html-single.xsl build/$(LINGUA)/source/hgbook.xml |
dongsheng@626 | 165 endif |
dongsheng@626 | 166 |
dongsheng@626 | 167 ifndef LINGUA |
dongsheng@626 | 168 pdf: |
dongsheng@626 | 169 for l in $(LANGUAGES); do \ |
dongsheng@626 | 170 $(MAKE) $@ LINGUA=$$l; \ |
dongsheng@626 | 171 done |
dongsheng@626 | 172 else |
dongsheng@626 | 173 pdf: build/$(LINGUA)/pdf/hgbook.pdf |
dongsheng@626 | 174 |
dongsheng@629 | 175 build/$(LINGUA)/pdf/hgbook.pdf: build/$(LINGUA)/source/hgbook.xml stylesheets/fo.xsl stylesheets/$(LINGUA)/fo.xsl |
dongsheng@626 | 176 mkdir -p build/$(LINGUA)/pdf |
dongsheng@626 | 177 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 | 178 com.icl.saxon.StyleSheet \ |
dongsheng@626 | 179 -x org.apache.xml.resolver.tools.ResolvingXMLReader \ |
dongsheng@626 | 180 -y org.apache.xml.resolver.tools.ResolvingXMLReader \ |
dongsheng@626 | 181 -r org.apache.xml.resolver.tools.CatalogResolver \ |
dongsheng@626 | 182 -o build/$(LINGUA)/source/hgbook.fo \ |
dongsheng@626 | 183 build/$(LINGUA)/source/hgbook.xml \ |
dongsheng@629 | 184 stylesheets/$(LINGUA)/fo.xsl \ |
dongsheng@626 | 185 fop1.extensions=1 |
dongsheng@626 | 186 |
dongsheng@626 | 187 (cd build/$(LINGUA)/source && ../../../tools/fop/fop.sh hgbook.fo ../pdf/hgbook.pdf) |
dongsheng@626 | 188 endif |
dongsheng@626 | 189 |
dongsheng@626 | 190 en/images/%.png: en/images/%.svg |
dongsheng@626 | 191 inkscape -D -d 120 -e $@ $< |
dongsheng@626 | 192 |
dongsheng@626 | 193 en/images/%.svg: en/images/%.dot |
dongsheng@626 | 194 dot -Tsvg -o $@ $< |