Makefile
branchpoesie
changeset 15 5d8d02c08a17
parent 14 ab0866b1578d
child 16 58d31c830386
equal deleted inserted replaced
14:ab0866b1578d 15:5d8d02c08a17
    41 DTD_DIR=$(TOP)/dtd
    41 DTD_DIR=$(TOP)/dtd
    42 STYLES=$(addprefix $(STYLES_DIR)/,common.xsl)
    42 STYLES=$(addprefix $(STYLES_DIR)/,common.xsl)
    43 HTML_STYLES=$(STYLES) $(addprefix $(STYLES_DIR)/,html.xsl poetry_html.xsl)
    43 HTML_STYLES=$(STYLES) $(addprefix $(STYLES_DIR)/,html.xsl poetry_html.xsl)
    44 PRINT_STYLES=$(STYLES) $(addprefix $(STYLES_DIR)/,print.xsl poetry_print.xsl masters_print.xsl)
    44 PRINT_STYLES=$(STYLES) $(addprefix $(STYLES_DIR)/,print.xsl poetry_print.xsl masters_print.xsl)
    45 DTD=$(addprefix $(DTD_DIR)/,poetry.dtd)
    45 DTD=$(addprefix $(DTD_DIR)/,poetry.dtd)
    46 SGML_CATALOG_FILES=$(CATALOG)
    46 SGML_CATALOG_FILES=$(TOP)/catalog
    47 export SGML_CATALOG_FILES
    47 export SGML_CATALOG_FILES
    48 xml_validate=xmllint --catalogs --xinclude $(1) |	\
    48 xml_validate=xmllint --catalogs --xinclude --postvalid --noout $(1)
    49 	sed -e 's/\(xmlns:xi\|xml:base\)="[^"]*"//g' |	\
       
    50 	xmllint --catalogs --valid --noout - 2>&1 |	\
       
    51 	sed 's/^-:/$(1):/'
       
    52 html_validate=true
    49 html_validate=true
    53 
    50 
    54 #REMOTE_DIR=o:public_html/poesie
    51 #REMOTE_DIR=o:public_html/poesie
    55 # FOP=xmlto pdf
    52 # FOP=xmlto pdf
    56 FOP=fop
    53 FOP=fop
    57 CATALOG=$(TOP)/catalog
       
    58 
    54 
    59 #OUTPUT=$(foreach target,$(basename $(SRCS)),$(call output,$(target)))
    55 #OUTPUT=$(foreach target,$(basename $(SRCS)),$(call output,$(target)))
    60 OUTPUT=poetry.pdf poetry/
    56 OUTPUT=poetry.pdf poetry/
    61 
    57 
    62 all: $(OUTPUT)
    58 all: $(OUTPUT)
    69 
    65 
    70 install: $(OUTPUT)
    66 install: $(OUTPUT)
    71 	[ -d $(INSTALL_DIR) ] || mkdir -p $(INSTALL_DIR)
    67 	[ -d $(INSTALL_DIR) ] || mkdir -p $(INSTALL_DIR)
    72 	cp -a $(OUTPUT)* $(INSTALL_DIR)
    68 	cp -a $(OUTPUT)* $(INSTALL_DIR)
    73 
    69 
    74 validate:
    70 validate: $(SRCS) $(addsuffix -validate,$(SRC_DEPS))
    75 	$(call xml_validate,$(SRCS))
    71 	$(call xml_validate,$<)
       
    72 
       
    73 %-validate: %
       
    74 	$(call xml_validate,$<)
    76 
    75 
    77 clean:
    76 clean:
    78 	rm -f *~ *.fo
    77 	rm -f *~ *.fo
    79 
    78 
    80 purge: clean
    79 purge: clean
    82 
    81 
    83 debug:
    82 debug:
    84 	echo $(PRINT_STYLES)
    83 	echo $(PRINT_STYLES)
    85 
    84 
    86 %.fo: %.xml $(PRINT_STYLES) $(SRC_DEPS)
    85 %.fo: %.xml $(PRINT_STYLES) $(SRC_DEPS)
    87 	SGML_CATALOG_FILES=$(CATALOG) xsltproc --catalogs --xinclude \
    86 	xsltproc --catalogs --xinclude			\
    88 		-o $@ $(STYLES_DIR)/poetry_print.xsl $<
    87 		-o $@ $(STYLES_DIR)/poetry_print.xsl $<
    89 
    88 
    90 %.pdf: %.fo
    89 %.pdf: %.fo
    91 #	SGML_CATALOG_FILES=$(CATALOG) xsltproc -o $@.tmp.fo strip-attributes.xsl $<
    90 #	xsltproc -o $@.tmp.fo strip-attributes.xsl $<
    92 #	xmlto pdf -o $(dir $@) $<
    91 #	xmlto pdf -o $(dir $@) $<
    93 	fop $< $@
    92 	fop $< $@
    94 #	rm $@.tmp.fo
    93 #	rm $@.tmp.fo
    95 
    94 
    96 %.html: %.xml $(HTML_STYLES) $(SRC_DEPS)
    95 %.html: %.xml $(HTML_STYLES) $(SRC_DEPS)
    97 	SGML_CATALOG_FILES=$(CATALOG) xsltproc --catalogs --xinclude \
    96 	xsltproc --catalogs --xinclude				\
    98 		--stringparam css-base-dir '/~fabien/styles/' \
    97 		--stringparam css-base-dir '/~fabien/styles/'	\
    99 		-o $@ $(STYLES_DIR)/poetry_html.xsl $<
    98 		-o $@ $(STYLES_DIR)/poetry_html.xsl $<
   100 
    99 
   101 %/index.html: %.xml $(HTML_STYLES) $(SRC_DEPS)
   100 %/index.html: %.xml $(HTML_STYLES) $(SRC_DEPS)
   102 	rm -rf $(dir $@)
   101 	rm -rf $(dir $@)
   103 	mkdir -p $(dir $@)
   102 	mkdir -p $(dir $@)
   104 	SGML_CATALOG_FILES=$(CATALOG) xsltproc --catalogs --xinclude \
   103 	xsltproc --catalogs --xinclude				\
   105 		--stringparam css-base-dir '/~fabien/styles/' \
   104 		--stringparam css-base-dir '/~fabien/styles/'	\
   106 		-o $@ $(STYLES_DIR)/poetry_html.xsl $<
   105 		-o $@ $(STYLES_DIR)/poetry_html.xsl $<
   107 
   106 
   108 %.txt: %.html
   107 %.txt: %.html
   109 	w3m -dump $< > $@
   108 	w3m -dump $< > $@
   110 
   109