Makefile
author fabien
Thu, 26 Jan 2006 16:51:42 -0500
branchcontes
changeset 6 f5ce1e175ca6
parent 5 b0d91312ad83
child 7 201b9e3f08dd
permissions -rw-r--r--
[svn r1968] r2250@freebird: fabien | 2006-01-26 16:51:01 -0500 New validation rule for used with my locally modified xmllint.

#/usr/bin/make

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

TOP=$(shell pwd)
INSTALL_DIR=$(TOP)/install
SRCS=contes.xml
SRC_DEPS=\
	dorsey.xml \
	jardin.xml \
	marche.xml \
	yeux.xml \
	genese.xml \
	mythos.xml
STYLES_DIR=$(TOP)/styles
DTD_DIR=$(TOP)/dtd
STYLES=$(addprefix $(STYLES_DIR)/,common.xsl)
HTML_STYLES=$(STYLES) $(addprefix $(STYLES_DIR)/,html.xsl story_html.xsl)
PRINT_STYLES=$(STYLES) $(addprefix $(STYLES_DIR)/,print.xsl story_print.xsl masters_print.xsl)
DTD=$(addprefix $(DTD_DIR)/,story.dtd)

# FOP=xmlto pdf
FOP=fop
SGML_CATALOG_FILES=$(TOP)/catalog
export SGML_CATALOG_FILES

#OUTPUT=$(foreach target,$(basename $(SRCS)),$(call output,$(target)))
OUTPUT=contes.pdf contes/
xml_validate=xmllint --catalogs --xinclude --postvalid --noout $(1)
html_validate=true

all: $(OUTPUT)

#poetry: $(call targets,poetry) $(SRC_DEPS)
contes/: contes/index.html

update: $(OUTPUT)
	rsync -avz -P $(OUTPUT) $(REMOTE_DIR)

install: $(OUTPUT)
	[ -d $(INSTALL_DIR) ] || mkdir -p $(INSTALL_DIR)
	cp -a $(OUTPUT)* $(INSTALL_DIR)

validate: $(SRCS) $(addsuffix -validate,$(SRC_DEPS))
	$(call xml_validate,$<)

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

clean:
	rm -f *~ *.fo

purge: clean
	rm -rf $(OUTPUT)

debug:
	echo $(PRINT_STYLES)

%.fo: %.xml $(PRINT_STYLES) $(SRC_DEPS)
	xsltproc --catalogs --xinclude			\
		-o $@ $(STYLES_DIR)/story_print.xsl $<

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

%.html: %.xml $(HTML_STYLES) $(SRC_DEPS)
	xsltproc --catalogs --xinclude				\
		--stringparam css-base-dir '/~fabien/styles/'	\
		-o $@ $(STYLES_DIR)/story_html.xsl $<

%/index.html: %.xml $(HTML_STYLES) $(SRC_DEPS)
	rm -rf $(dir $@)
	mkdir -p $(dir $@)
	xsltproc --catalogs --xinclude				\
		--stringparam css-base-dir '/~fabien/styles/'	\
		-o $@ $(STYLES_DIR)/story_html.xsl $<

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