|
1 #!/usr/bin/make |
|
2 |
|
3 # No final slash here! |
|
4 # It will mess up rsync behavior. |
|
5 TARGETS=couleurs colors jjch credo |
|
6 UPDATE_FILES=$(TARGETS) index.en.html index.fr.html |
|
7 SSH_HOST=o |
|
8 SRC_DIR=`pwd` |
|
9 REMOTE_DIR=/var/www/harmonies/articles |
|
10 SGML_CATALOG_FILES=/etc/sgml/catalog |
|
11 |
|
12 make_subdir=\ |
|
13 [ -d $(2) ] || mkdir -p $(2) ; \ |
|
14 $(MAKE) SRC_DIR=$(SRC_DIR) VPATH=$(SRC_DIR) \ |
|
15 -C $(2) -f $(SRC_DIR)/Makefile $(1) |
|
16 |
|
17 all: $(addsuffix -do,$(TARGETS)) |
|
18 |
|
19 $(addsuffix -do,$(TARGETS)): |
|
20 $(call make_subdir,$(patsubst %-do,%,$@),$(patsubst %-do,%,$@)) |
|
21 |
|
22 clean: |
|
23 rm -rf *~ *.fo *.aux *.log *.out |
|
24 |
|
25 purge: |
|
26 rm -rf $(TARGETS) |
|
27 |
|
28 $(TARGETS): |
|
29 $(MAKE) -f $(SRC_DIR)/Makefile $@.pdf $@.txt $@/index.html $@.html |
|
30 |
|
31 %.fo: %.xml $(SRC_DIR)/print.xsl |
|
32 xsltproc -o $@ $(SRC_DIR)/print.xsl $< |
|
33 |
|
34 TEX_OPTIONS=-interaction=errorstopmode -file-line-error-style |
|
35 TEXERRORLEVEL=2 |
|
36 MAX_TEX_RECURSION=4 |
|
37 %.pdf: %.fo |
|
38 # -cp -pf prior.aux pprior.aux |
|
39 # -cp -pf $(basename $<).aux prior.aux |
|
40 # pdfxmltex $(TEX_OPTIONS) $< || [ $$? -lt $(TEXERRORLEVEL) ] |
|
41 # if ! cmp $(basename $<).aux prior.aux && \ |
|
42 # ! cmp $(basename $<).aux pprior.aux && \ |
|
43 # expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION); then \ |
|
44 # rm -f $@ ; \ |
|
45 # $(MAKE) -f $(SRC_DIR)/Makefile $@ ; \ |
|
46 # fi |
|
47 # rm -f prior.aux pprior.aux |
|
48 # xmlto pdf $< |
|
49 fop $< $@ |
|
50 |
|
51 %.txt: %.html |
|
52 w3m -dump $< > $@ |
|
53 |
|
54 %/index.html: %.xml $(SRC_DIR)/chunk.xsl |
|
55 rm -rf $(dir $@) |
|
56 xsltproc -o $(dir $@) $(SRC_DIR)/chunk.xsl $< |
|
57 |
|
58 %.html: %.xml $(SRC_DIR)/html.xsl |
|
59 xsltproc -o $@ $(SRC_DIR)/html.xsl $< |
|
60 |
|
61 update: all |
|
62 rsync -az --delete $(UPDATE_FILES) $(SSH_HOST):$(REMOTE_DIR) |
|
63 ssh $(SSH_HOST) chmod -R a+rX $(REMOTE_DIR) |
|
64 |
|
65 .PHONY: $(TARGETS) $(addsuffix -do,$(TARGETS)) update clean all |