hgbook
diff en/Makefile @ 594:0b45854f0b7b
Generate and include images properly.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu Mar 26 22:00:53 2009 -0700 (2009-03-26) |
parents | 188efaefe001 |
children | e0a4ba81f888 |
line diff
1.1 --- a/en/Makefile Thu Mar 19 22:45:02 2009 -0700 1.2 +++ b/en/Makefile Thu Mar 26 22:00:53 2009 -0700 1.3 @@ -1,28 +1,6 @@ 1.4 # This makefile requires GNU make. 1.5 1.6 -image-sources := \ 1.7 - feature-branches.dot \ 1.8 - filelog.svg \ 1.9 - kdiff3.png \ 1.10 - metadata.svg \ 1.11 - mq-stack.svg \ 1.12 - note.png \ 1.13 - revlog.svg \ 1.14 - snapshot.svg \ 1.15 - tour-history.svg \ 1.16 - tour-merge-conflict.svg \ 1.17 - tour-merge-merge.svg \ 1.18 - tour-merge-pull.svg \ 1.19 - tour-merge-sep-repos.svg \ 1.20 - undo-manual.dot \ 1.21 - undo-manual-merge.dot \ 1.22 - undo-non-tip.dot \ 1.23 - undo-simple.dot \ 1.24 - wdir.svg \ 1.25 - wdir-after-commit.svg \ 1.26 - wdir-branch.svg \ 1.27 - wdir-merge.svg \ 1.28 - wdir-pre-branch.svg 1.29 +image-sources := $(wildcard figs/*.dot figs/*.png figs/*.svg) 1.30 1.31 xml-src-files := \ 1.32 00book.xml \ 1.33 @@ -33,7 +11,14 @@ 1.34 image-svg := $(filter %.svg,$(image-sources)) 1.35 image-png := $(filter %.png,$(image-sources)) 1.36 1.37 -image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) 1.38 +obj-web := html 1.39 +obj-websup := $(obj-web)/support 1.40 +obj-web-read := $(obj-web)/read 1.41 + 1.42 +image-web := \ 1.43 + $(image-dot:%.dot=$(obj-web-read)/%.png) \ 1.44 + $(image-svg:%.svg=$(obj-web-read)/%.png) \ 1.45 + $(image-png:%=$(obj-web-read)/%) 1.46 1.47 example-sources-by-name := \ 1.48 backout \ 1.49 @@ -71,9 +56,6 @@ 1.50 $(example-sources-by-name:%=examples/%) \ 1.51 $(wildcard examples/ch*/*) 1.52 1.53 -obj-web := html 1.54 -obj-websup := html/support 1.55 - 1.56 extras-web-base := \ 1.57 $(obj-web)/index.html \ 1.58 $(obj-web)/robots.txt \ 1.59 @@ -135,14 +117,16 @@ 1.60 1.61 web: ../xsl/system-xsl websup html 1.62 1.63 -html: ../xsl/system-xsl $(xml-src-files) valid 1.64 - xsltproc $(xsltproc-opts) -o html/read/x ../xsl/chunk-stylesheet.xsl 00book.xml 1.65 - for i in html/read/*.html; do \ 1.66 +html: $(obj-web-read)/index.html 1.67 + 1.68 +$(obj-web-read)/index.html: ../xsl/system-xsl .validated-00book.xml 1.69 + xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../xsl/chunk-stylesheet.xsl 00book.xml 1.70 + for i in $(obj-web-read)/*.html; do \ 1.71 gzip -9 -c $$i > $$i.gz; \ 1.72 done 1.73 1.74 -websup: $(extras-web) 1.75 - mkdir -p $(obj-websup)/figs 1.76 +websup: $(extras-web) $(image-web) 1.77 + mkdir -p $(obj-websup)/figs $(obj-web-read)/figs 1.78 cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs 1.79 cp -f ../web/icons/*.png $(obj-websup)/figs 1.80 1.81 @@ -159,12 +143,23 @@ 1.82 1.83 # Produce 90dpi PNGs for the web. 1.84 1.85 -%.png: %.svg fixsvg 1.86 +$(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg 1.87 + mkdir -p $(dir $@) 1.88 ./fixsvg $< 1.89 inkscape -D -e $@ $<-tmp.svg 1.90 rm $<-tmp.svg 1.91 1.92 -%.svg: %.dot 1.93 +$(obj-web-read)/figs/%.png: figs/%.svg fixsvg 1.94 + mkdir -p $(dir $@) 1.95 + ./fixsvg $< 1.96 + inkscape -D -e $@ $<-tmp.svg 1.97 + rm $<-tmp.svg 1.98 + 1.99 +$(obj-web-read)/figs/%.png: figs/%.png 1.100 + cp $< $@ 1.101 + 1.102 +$(obj-web-read)/figs/%.svg: figs/%.dot 1.103 + mkdir -p $(dir $@) 1.104 dot -Tsvg -o $@ $< 1.105 1.106 examples: $(example-prereqs) examples/.run