hgbook
changeset 880:a821682ea3a5
Attach it to building
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Wed Oct 21 16:10:27 2009 +0800 (2009-10-21) |
parents | 4688f8ac941d |
children | 3df0c9cfe902 |
files | Makefile |
line diff
1.1 --- a/Makefile Wed Oct 21 15:43:16 2009 +0800 1.2 +++ b/Makefile Wed Oct 21 16:10:27 2009 +0800 1.3 @@ -6,7 +6,7 @@ 1.4 FORMATS=html html-single pdf epub 1.5 1.6 PO_LANGUAGES := zh 1.7 -DBK_LANGUAGES := en 1.8 +DBK_LANGUAGES := en it 1.9 LANGUAGES := $(DBK_LANGUAGES) $(PO_LANGUAGES) 1.10 1.11 UPDATEPO = PERLLIB=$(PO4A_LIB) $(PO4A_HOME)/po4a-updatepo -M UTF-8 \ 1.12 @@ -22,76 +22,38 @@ 1.13 #rev_id = $(shell hg parents --template '{node|short} ({date|isodate})') 1.14 rev_id = $(shell hg parents --template '{node|short} ({date|shortdate})') 1.15 1.16 -images := \ 1.17 - en/figs/bad-merge-1.png \ 1.18 - en/figs/bad-merge-2.png \ 1.19 - en/figs/bad-merge-3.png \ 1.20 - en/figs/bad-merge-4.png \ 1.21 - en/figs/bad-merge-5.png \ 1.22 - en/figs/feature-branches.png \ 1.23 - en/figs/filelog.png \ 1.24 - en/figs/metadata.png \ 1.25 - en/figs/mq-stack.png \ 1.26 - en/figs/revlog.png \ 1.27 - en/figs/snapshot.png \ 1.28 - en/figs/tour-history.png \ 1.29 - en/figs/tour-merge-conflict.png \ 1.30 - en/figs/tour-merge-merge.png \ 1.31 - en/figs/tour-merge-pull.png \ 1.32 - en/figs/tour-merge-sep-repos.png \ 1.33 - en/figs/undo-manual-merge.png \ 1.34 - en/figs/undo-manual.png \ 1.35 - en/figs/undo-non-tip.png \ 1.36 - en/figs/undo-simple.png \ 1.37 - en/figs/wdir-after-commit.png \ 1.38 - en/figs/wdir-branch.png \ 1.39 - en/figs/wdir-merge.png \ 1.40 - en/figs/wdir.png \ 1.41 - en/figs/wdir-pre-branch.png 1.42 +images-src := $(wildcard en/figs/*.dot en/figs/*.svg en/figs/*.png) 1.43 + 1.44 +images-dot := $(filter %.dot, $(images-src)) 1.45 +images-svg := $(filter %.svg, $(images-src)) 1.46 + 1.47 +images-dst := $(images-src:dot=png) 1.48 +images-dst := $(images-dst:svg=png) 1.49 + 1.50 +images-out := $(images-dot:dot=svg) 1.51 +images-out += $(images-dot:dot=png) 1.52 +images-out += $(images-svg:svg=png) 1.53 1.54 help: 1.55 - @echo " make epub [LINGUA=en|zh|...]" 1.56 - @echo " make html [LINGUA=en|zh|...]" 1.57 - @echo " make html-single [LINGUA=en|zh|...]" 1.58 - @echo " make pdf [LINGUA=en|zh|...]" 1.59 - @echo " make validate [LINGUA=en|zh|...] # always before commit!" 1.60 + @echo " make epub [LINGUA=en|it|zh|...]" 1.61 + @echo " make html [LINGUA=en|it|zh|...]" 1.62 + @echo " make html-single [LINGUA=en|it|zh|...]" 1.63 + @echo " make pdf [LINGUA=en|it|zh|...]" 1.64 + @echo " make validate [LINGUA=en|it|zh|...] # always before commit!" 1.65 @echo " make tidypo [LINGUA=zh|...] # always before commit!" 1.66 @echo " make updatepo [LINGUA=zh|...] # update po files." 1.67 - @echo " make all [LINGUA=en|zh|...]" 1.68 + @echo " make all [LINGUA=en|it|zh|...]" 1.69 @echo " make stat # print statistics about po files." 1.70 @echo " make clean # Remove the build files." 1.71 1.72 clean: 1.73 - @rm -fr build po/*.mo hello en/hello en/html en/.validated-00book.xml en/examples/.run en/examples/results \ 1.74 - stylesheets/system-xsl en/figs/*-tmp.svg \ 1.75 - web/index-read.html.in \ 1.76 - en/figs/bad-merge-1.png \ 1.77 - en/figs/bad-merge-2.png \ 1.78 - en/figs/bad-merge-3.png \ 1.79 - en/figs/bad-merge-4.png \ 1.80 - en/figs/bad-merge-5.png \ 1.81 - en/figs/feature-branches.png \ 1.82 - en/figs/filelog.png \ 1.83 - en/figs/feature-branches.png \ 1.84 - en/figs/filelog.png \ 1.85 - en/figs/metadata.png \ 1.86 - en/figs/mq-stack.png \ 1.87 - en/figs/revlog.png \ 1.88 - en/figs/snapshot.png \ 1.89 - en/figs/tour-history.png \ 1.90 - en/figs/tour-merge-conflict.png \ 1.91 - en/figs/tour-merge-merge.png \ 1.92 - en/figs/tour-merge-pull.png \ 1.93 - en/figs/tour-merge-sep-repos.png \ 1.94 - en/figs/undo-manual-merge.png \ 1.95 - en/figs/undo-manual.png \ 1.96 - en/figs/undo-non-tip.png \ 1.97 - en/figs/undo-simple.png \ 1.98 - en/figs/wdir-after-commit.png \ 1.99 - en/figs/wdir-branch.png \ 1.100 - en/figs/wdir-merge.png \ 1.101 - en/figs/wdir-pre-branch.png \ 1.102 - en/figs/wdir.png 1.103 + @rm -fr build hello po/*.mo en/hello en/html en/.validated-00book.xml \ 1.104 + en/examples/.run en/examples/results en/figs/*-tmp.svg \ 1.105 + stylesheets/system-xsl web/index-read.html.in 1.106 + 1.107 + @(for l in $(DBK_LANGUAGES); do \ 1.108 + rm -fr $(subst en/figs/, $$l/figs/, $(images-out)) ;\ 1.109 + done) 1.110 1.111 all: 1.112 ifdef LINGUA 1.113 @@ -117,8 +79,10 @@ 1.114 1.115 tidypo: 1.116 ifdef LINGUA 1.117 +ifneq "$(findstring $(LINGUA),$(PO_LANGUAGES))" "" 1.118 msgcat --sort-by-file --width=80 po/$(LINGUA).po > po/$(LINGUA).tmp && \ 1.119 mv po/$(LINGUA).tmp po/$(LINGUA).po; 1.120 +endif 1.121 else 1.122 for po in $(wildcard po/*.po); do \ 1.123 msgcat --sort-by-file --width=80 $$po > $$po.tmp && mv $$po.tmp $$po; \ 1.124 @@ -151,9 +115,13 @@ 1.125 1.126 ifneq "$(findstring $(LINGUA),$(DBK_LANGUAGES))" "" 1.127 $(LINGUA)/examples/.run: 1.128 - (cd $(LINGUA)/examples; ./run-example -v -a) 1.129 - 1.130 -build/$(LINGUA)/source/hgbook.xml: $(wildcard $(LINGUA)/*.xml) $(images) $(LINGUA)/examples/.run 1.131 + if test -x $(LINGUA)/examples/run-example; then \ 1.132 + (cd $(LINGUA)/examples; ./run-example -v -a); \ 1.133 + else \ 1.134 + touch $@; \ 1.135 + fi 1.136 + 1.137 +build/$(LINGUA)/source/hgbook.xml: $(wildcard $(LINGUA)/*.xml) $(subst en/figs/, $(LINGUA)/figs/, $(images-dst)) $(LINGUA)/examples/.run 1.138 mkdir -p build/$(LINGUA)/source/figs 1.139 cp $(LINGUA)/figs/*.png build/$(LINGUA)/source/figs 1.140 cp stylesheets/hgbook.css build/$(LINGUA)/source 1.141 @@ -166,7 +134,7 @@ 1.142 build/en/source/hgbook.xml: 1.143 ${MAKE} LINGUA=en $@ 1.144 1.145 -build/$(LINGUA)/source/hgbook.xml: $(wildcard en/*.xml) po/$(LINGUA).po $(images) 1.146 +build/$(LINGUA)/source/hgbook.xml: $(wildcard en/*.xml) po/$(LINGUA).po $(images-dst) 1.147 mkdir -p build/$(LINGUA)/source/figs 1.148 cp en/figs/*.png build/$(LINGUA)/source/figs 1.149 cp stylesheets/hgbook.css build/$(LINGUA)/source 1.150 @@ -246,6 +214,17 @@ 1.151 (cd build/$(LINGUA)/source && $(FOP_HOME)/fop.sh -c $(FOP_HOME)/conf/userconfig.xml hgbook.fo ../pdf/hgbook.pdf) 1.152 endif 1.153 1.154 +$(LINGUA)/figs/%.png: $(LINGUA)/figs/%.svg 1.155 + if test -x $(LINGUA)/fixsvg; then \ 1.156 + $(LINGUA)/fixsvg $<; \ 1.157 + inkscape -D -d 120 -e $@ $<-tmp.svg; \ 1.158 + else \ 1.159 + inkscape -D -d 120 -e $@ $<; \ 1.160 + fi 1.161 + 1.162 +$(LINGUA)/figs/%.svg: $(LINGUA)/figs/%.dot 1.163 + dot -Tsvg -o $@ $< 1.164 + 1.165 en/figs/%.png: en/figs/%.svg en/fixsvg 1.166 en/fixsvg $< 1.167 inkscape -D -d 120 -e $@ $<-tmp.svg