diff en/Makefile @ 753:1c13ed2130a7

Merge with http://hg.serpentine.com/mercurial/book
author Dongsheng Song <dongsheng.song@gmail.com>
date Mon, 30 Mar 2009 16:23:33 +0800
parents 7e7c47481e4f 9e8e5292acaa
children 3b33dd6aba87
line wrap: on
line diff
--- a/en/Makefile	Fri Mar 20 17:17:55 2009 +0800
+++ b/en/Makefile	Mon Mar 30 16:23:33 2009 +0800
@@ -1,28 +1,6 @@
 # This makefile requires GNU make.
 
-image-sources := \
-	feature-branches.dot \
-	filelog.svg \
-	kdiff3.png \
-	metadata.svg \
-	mq-stack.svg \
-	note.png \
-	revlog.svg \
-	snapshot.svg \
-	tour-history.svg \
-	tour-merge-conflict.svg \
-	tour-merge-merge.svg \
-	tour-merge-pull.svg \
-	tour-merge-sep-repos.svg \
-	undo-manual.dot \
-	undo-manual-merge.dot \
-	undo-non-tip.dot \
-	undo-simple.dot \
-	wdir.svg \
-	wdir-after-commit.svg \
-	wdir-branch.svg \
-	wdir-merge.svg \
-	wdir-pre-branch.svg
+image-sources := $(wildcard figs/*.dot figs/*.gif figs/*.png figs/*.svg)
 
 xml-src-files := \
 	00book.xml \
@@ -31,9 +9,16 @@
 
 image-dot := $(filter %.dot,$(image-sources))
 image-svg := $(filter %.svg,$(image-sources))
-image-png := $(filter %.png,$(image-sources))
+image-oth := $(filter %.gif %.png,$(image-sources))
 
-image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
+obj-web := html
+obj-websup := $(obj-web)/support
+obj-web-read := $(obj-web)/read
+
+image-web := \
+	$(image-dot:%.dot=$(obj-web-read)/%.png) \
+	$(image-svg:%.svg=$(obj-web-read)/%.png) \
+	$(image-oth:%=$(obj-web-read)/%)
 
 example-sources-by-name := \
 	backout \
@@ -71,9 +56,6 @@
 	$(example-sources-by-name:%=examples/%) \
 	$(wildcard examples/ch*/*)
 
-obj-web := html
-obj-websup := html/support
-
 extras-web-base := \
 	$(obj-web)/index.html \
 	$(obj-web)/robots.txt \
@@ -130,24 +112,30 @@
 
 all: web
 
-../xsl/system-xsl: $(system-xsl-dir)
+../stylesheets/system-xsl: $(system-xsl-dir)
 	ln -s $< $@
 
-web: ../xsl/system-xsl websup html
+web: ../stylesheets/system-xsl websup html
+
+html: $(obj-web-read)/index.html
 
-html: ../xsl/system-xsl $(xml-src-files) valid
-	xsltproc $(xsltproc-opts) -o html/read/x ../xsl/chunk-stylesheet.xsl 00book.xml
-	for i in html/read/*.html; do \
+../web/index-read.html.in: ../web/genindex.py $(xml-src-files)
+	$<
+
+$(obj-web-read)/index.html: ../stylesheets/system-xsl .validated-00book.xml ../web/index-read.html.in
+	xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../stylesheets/chunk-stylesheet.xsl 00book.xml
+	python ../web/texpand.py ../web/index-read.html.in html/read/index.html
+	for i in $(obj-web-read)/*.html; do \
 	  gzip -9 -c $$i > $$i.gz; \
 	done
 
-websup: $(extras-web)
-	mkdir -p $(obj-websup)/figs
-	cp ../xsl/system-xsl/images/*.png $(obj-websup)/figs
+websup: $(extras-web) $(image-web)
+	mkdir -p $(obj-websup)/figs $(obj-web-read)/figs
+	cp ../stylesheets/system-xsl/images/*.png $(obj-websup)/figs
 	cp -f ../web/icons/*.png $(obj-websup)/figs
 
-all-ids.dat: ../xsl/all-ids.xsl $(xml-src-files)
-	$(xsltproc) $(xsltproc-opts) -o $@ ../xsl/all-ids.xsl 00book.xml
+all-ids.dat: ../stylesheets/all-ids.xsl $(xml-src-files)
+	$(xsltproc) $(xsltproc-opts) -o $@ ../stylesheets/all-ids.xsl 00book.xml
 
 web: websup
 
@@ -159,12 +147,26 @@
 
 # Produce 90dpi PNGs for the web.
 
-%.png: %.svg fixsvg
+$(obj-web-read)/figs/%.png: $(obj-web-read)/figs/%.svg fixsvg
+	mkdir -p $(dir $@)
 	./fixsvg $<
 	inkscape -D -e $@ $<-tmp.svg
 	rm $<-tmp.svg
 
-%.svg: %.dot
+$(obj-web-read)/figs/%.png: figs/%.svg fixsvg
+	mkdir -p $(dir $@)
+	./fixsvg $<
+	inkscape -D -e $@ $<-tmp.svg
+	rm $<-tmp.svg
+
+$(obj-web-read)/figs/%.gif: figs/%.gif
+	cp $< $@
+
+$(obj-web-read)/figs/%.png: figs/%.png
+	cp $< $@
+
+$(obj-web-read)/figs/%.svg: figs/%.dot
+	mkdir -p $(dir $@)
 	dot -Tsvg -o $@ $<
 
 examples: $(example-prereqs) examples/.run
@@ -188,6 +190,7 @@
 	rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
 
 vpath %.css ../web
+vpath %.html.in ../web
 vpath %.js ../web/javascript
 
 $(obj-websup)/%.css: %.css