Makefile
author fabien
Thu, 14 Feb 2008 16:46:36 -0500
branchcda
changeset 14 54a2d205f350
parent 9 af2604ead11f
child 18 9765d57d1f54
permissions -rw-r--r--
[svn] Remplacement des feuilles de personnage par de nouvelles feuilles plus fonctionnelles.

#/usr/bin/make

targets=$(addprefix $(1), .html .pdf .txt /index.html)
output=$(addprefix $(1), .html .pdf .txt) $(1)

TOP=`pwd`
INSTALL_DIR=$(TOP)/install
SRCS=cda.xml
FOP=fop
NWALSH_XSL_DIR=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh
OO_PDF_OUTPUT_DIR=$(HOME)/pdf

PDF_OUTPUT=cda-perso.pdf cda-perso-alt.pdf presentation.pdf
OUTPUT=$(foreach target,$(basename $(SRCS)),$(call output,$(target))) \
	$(PDF_OUTPUT)
UPLOAD=$(OUTPUT) cda-perso.sxw cda-perso-alt.sxw presentation.sxi index.fr.html blason.png
xml_validate=xmllint --xinclude --noout $(1)
html_validate=$(call xml_validate,$(1))

all: $(basename $(SRCS)) $(PDF_OUTPUT)

# Should I need to validate other file? Can I?
validate: $(addsuffix -validate, $(SRCS) index.fr.html)

%.xml-validate: %.xml
	$(call xml_validate,$<)

%.html-validate: %.html
	$(call html_validate,$<)

cda: $(call targets,cda)


# title.xsl: title.xml
#	xsltproc -o $@ $(NWALSH_XSL_DIR)/template/titlepage.xsl $<

%.fo: %.xml print.xsl titlepage.xsl common.xsl
	xsltproc -o $@ print.xsl $<

%.pdf: %.fo
#	xsltproc -o $@.tmp.fo strip-attributes.xsl $<
#	xmlto pdf -o $(dir $@) $<
	fop $< $@
#	rm $@.tmp.fo

%.pdf: %.sxw
	xvfb-run -a oowriter2 -pt PDF $<
	mv $(OO_PDF_OUTPUT_DIR)/$@ $@

%.pdf: %.sxi
	xvfb-run -a ooimpress2 -pt PDF $<
	mv $(OO_PDF_OUTPUT_DIR)/$@ $@

%.html: %.xml html.xsl common.xsl
	xsltproc --xinclude -o $@ html.xsl $<
#	recode u8..l1 $@

%/index.html: %.xml chunk.xsl common.xsl
	rm -rf $(dir $@)
	mkdir -p $(dir $@)
	xsltproc --xinclude -o $(dir $@) chunk.xsl $<

%.txt: %.html
	w3m -dump $< > $@

install: $(UPLOAD)
	-mkdir -p $(INSTALL_DIR)
	cp -a $^ $(INSTALL_DIR)

clean:
	rm -f *~ *.fo

purge: clean
	rm -rf $(OUTPUT)

.PHONY: clean install purge validate all