diff en/Makefile @ 674:bebd5ff7fe7f

And there was much tidying, and the result was good.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 10 Mar 2009 21:58:03 -0700
parents 3bcc001ce34f
children 1879ec732a28 8366882f67f2 c88aa4edf9df
line wrap: on
line diff
--- a/en/Makefile	Tue Mar 10 21:42:19 2009 -0700
+++ b/en/Makefile	Tue Mar 10 21:58:03 2009 -0700
@@ -67,6 +67,21 @@
 	tour \
 	tour-merge-conflict
 
+obj-web := html
+obj-websup := html/support
+
+extras-web-base := \
+	$(obj-web)/index.html \
+	$(obj-web)/robots.txt \
+	$(obj-websup)/form-min.js \
+	$(obj-websup)/form.js \
+	$(obj-websup)/hsbook.js \
+	$(obj-websup)/jquery-min.js \
+	$(obj-websup)/jquery.js \
+	$(obj-websup)/styles.css
+
+extras-web := $(extras-web-base) $(extras-web-base:%=%.gz)
+
 xsltproc := xsltproc
 xsltproc-opts := --nonet --xinclude --path '$(xml-path)'
 
@@ -109,13 +124,25 @@
 hg-version = $(shell hg version -q | \
 		     sed 's,.*(version \(unknown\|[a-f0-9+]*\)),\1,')
 
-all: html
+all: web
 
 ../xsl/system-xsl: $(system-xsl-dir)
 	ln -s $< $@
 
+web: websup html
+
 html: ../xsl/system-xsl $(xml-src-files) valid
-	xsltproc $(xsltproc-opts) -o html/x ../xsl/chunk-stylesheet.xsl 00book.xml
+	xsltproc $(xsltproc-opts) -o html/read/x ../xsl/chunk-stylesheet.xsl 00book.xml
+	for i in html/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
+	cp -f ../web/icons/*.png $(obj-websup)/figs
+
+web: websup
 
 valid: .validated-00book.xml
 
@@ -153,3 +180,29 @@
 
 rsync: install
 	rsync -avz --delete dist sp.red-bean.com:public_html/hgbook
+
+vpath %.css ../web
+vpath %.js ../web/javascript
+
+$(obj-websup)/%.css: %.css
+	@mkdir -p $(dir $@)
+	cp $< $@
+
+$(obj-websup)/%.jpg: %.jpg
+	@mkdir -p $(dir $@)
+	cp $< $@
+
+$(obj-websup)/%.js: %.js
+	@mkdir -p $(dir $@)
+	cp $< $@
+
+$(obj-web)/%: ../web/%
+	@mkdir -p $(dir $@)
+	cp $< $@
+
+$(obj-web)/%.html: %.html.in
+	@mkdir -p $(dir $@)
+	python ../web/texpand.py $< $@
+
+%.gz: %
+	gzip -9 -c $< > $@