Makefile
branchecjdr
changeset 0 9119688b1f02
child 13 7ef1648bebae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Mon Dec 26 19:21:22 2005 -0500
@@ -0,0 +1,65 @@
+#!/usr/bin/make
+
+# No final slash here!
+# It will mess up rsync behavior.
+TARGETS=couleurs colors jjch credo
+UPDATE_FILES=$(TARGETS) index.en.html index.fr.html
+SSH_HOST=o
+SRC_DIR=`pwd`
+REMOTE_DIR=/var/www/harmonies/articles
+SGML_CATALOG_FILES=/etc/sgml/catalog
+
+make_subdir=\
+	[ -d $(2) ] || mkdir -p $(2) ; \
+	$(MAKE) SRC_DIR=$(SRC_DIR) VPATH=$(SRC_DIR) \
+		-C $(2) -f $(SRC_DIR)/Makefile $(1)
+
+all: $(addsuffix -do,$(TARGETS))
+
+$(addsuffix -do,$(TARGETS)):
+	$(call make_subdir,$(patsubst %-do,%,$@),$(patsubst %-do,%,$@))
+
+clean:
+	rm -rf *~ *.fo *.aux *.log *.out
+
+purge:
+	rm -rf $(TARGETS)
+
+$(TARGETS): 
+	$(MAKE) -f $(SRC_DIR)/Makefile $@.pdf $@.txt $@/index.html $@.html
+
+%.fo: %.xml $(SRC_DIR)/print.xsl
+	xsltproc -o $@ $(SRC_DIR)/print.xsl $< 
+
+TEX_OPTIONS=-interaction=errorstopmode -file-line-error-style
+TEXERRORLEVEL=2
+MAX_TEX_RECURSION=4
+%.pdf: %.fo
+# 	-cp -pf prior.aux pprior.aux
+# 	-cp -pf $(basename $<).aux prior.aux
+# 	pdfxmltex $(TEX_OPTIONS) $< || [ $$? -lt $(TEXERRORLEVEL) ]
+# 	if ! cmp $(basename $<).aux prior.aux &&	\
+# 	   ! cmp $(basename $<).aux pprior.aux &&	\
+# 	   expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION); then	\
+# 		rm -f $@ ;					\
+# 		$(MAKE) -f $(SRC_DIR)/Makefile $@ ;					\
+# 	fi
+# 	rm -f prior.aux pprior.aux
+#	xmlto pdf $<
+	fop $< $@
+
+%.txt: %.html
+	w3m -dump $< > $@
+
+%/index.html: %.xml $(SRC_DIR)/chunk.xsl
+	rm -rf $(dir $@)
+	xsltproc -o $(dir $@) $(SRC_DIR)/chunk.xsl $<
+
+%.html: %.xml $(SRC_DIR)/html.xsl
+	xsltproc -o $@ $(SRC_DIR)/html.xsl $<
+
+update: all
+	rsync -az --delete $(UPDATE_FILES) $(SSH_HOST):$(REMOTE_DIR)
+	ssh $(SSH_HOST) chmod -R a+rX $(REMOTE_DIR)
+
+.PHONY: $(TARGETS) $(addsuffix -do,$(TARGETS)) update clean all