# # $Id$ # # # The name of the index file (the one which will be built by default # without specifying a target # DOCUMENTS ?= index # # The root of the document tree, this is used to determine the directory # of auxiliary files. The variable should be overwritten by per-directory # Makefiles # ROOT_DIR ?= ../../.. # # Output directory where files produced by XSL stylesheets should be stored, # by default we output to the same directory, documents that are chunked may # choose to override this to write all chunks in a subdirectory instead # OUTPUT_DIR ?= . # # Stylesheet used to generate dependencies from XML files # DEP_XSL ?= $(ROOT_DIR)/doc/stylesheets/dep.xsl # # Default stylesheet used to generate XHTML # XHTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/xhtml.xsl # # Default stylesheet used to generate Drupal HTML without html headers # DRUPAL_XSL ?= $(ROOT_DIR)/doc/stylesheets/drupal.xsl # # Default stylesheet used to generate HTML # HTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/html.chunked.xsl # # Stylesheet used to generate plain text documents, # this is usually the one used for xhtml # TXT_XSL ?= $(ROOT_DIR)/doc/stylesheets/txt.xsl # # Stylesheet used to generate FO (Formatted Objects) # This is used by PDF generators # FO_XSL ?= $(ROOT_DIR)/doc/stylesheets/fo.xsl # # Disable document validation by default # VALIDATE ?= 0 CATALOG=$(ROOT_DIR)/doc/catalog.xml LYNX ?= lynx DIA ?= dia XSLTPROC ?= xsltproc XMLLINT ?= /usr/bin/xmllint XEP ?= /usr/bin/xep LYNX_FLAGS ?= -nolist DIA_ARGS ?= XSLTPROC_FLAGS ?= XMLLINT_FLAGS ?= --xinclude --postvalid --noout XEP_FLAGS ?= ifeq ($(VALIDATE), 0) override XSLTPROC_FLAGS := $(XSLTPROC_FLAGS) --novalid endif alldep = Makefile $(ROOT_DIR)/Makefile.doc $(DEP_XSL) $(EXTRA_DEPS) all: xhtml xml_files = $(addsuffix .xml, $(DOCUMENTS)) dep_files = $(addsuffix .d, $(DOCUMENTS)) xhtml_files = $(addsuffix .xhtml, $(DOCUMENTS)) html_files = $(addsuffix .html, $(DOCUMENTS)) txt_files = $(addsuffix .txt, $(DOCUMENTS)) pdf_files = $(addsuffix .pdf, $(DOCUMENTS)) xhtml: $(xhtml_files) html: $(html_files) txt: $(txt_files) pdf: $(pdf_files) drupal: override HTML_XSL := $(DRUPAL_XSL) drupal: $(html_files) %.xhtml: %.xml %.d $(alldep) $(XHTML_XSL) XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \ --xinclude \ --stringparam base.dir "$(OUTPUT_DIR)/" \ --stringparam root.filename "$(basename $<)" \ --stringparam html.ext ".xhtml" \ $(XHTML_XSL) $< %.html: %.xml %.d $(alldep) $(HTML_XSL) XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \ --xinclude \ --stringparam base.dir "$(OUTPUT_DIR)/" \ --stringparam root.filename "$(basename $<)" \ --stringparam html.ext ".html" \ --stringparam html.stylesheet ser.css \ $(HTML_XSL) $< %.fo: %.xml $(alldep) $(FO_XSL) XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \ --xinclude \ -o $@ $(FO_XSL) $< %.pdf: %.fo %.d $(alldep) $(XEP) $(XEP_FLAGS) -fo $< -pdf $@ %.txt: %.xml %.d $(alldep) XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \ --xinclude \ $(TXT_XSL) $< | $(LYNX) $(LYNX_FLAGS) -stdin -dump > $@ %.png: %.dia $(alldep) $(DIA) $(DIA_ARGS) -t png -e $@ $< %.d: %.xml $(alldep) $(XSLTPROC) $(XSLTPROC_FLAGS) \ --nonet \ --novalid \ --stringparam output "$@" \ $(DEP_XSL) $< .PHONY: check check: $(xml_files) XML_CATALOG_FILES=$(CATALOG) $(XMLLINT) $(XMLLINT_FLAGS) $< .PHONY: clean clean: @rm -f $(txt_files) @rm -f $(xhtml_files) @rm -f $(pdf_files) @rm -f $(html_files) .PHONY: proper realclean distclean proper realclean distclean: clean @rm -f $(dep_files) *~ ifeq (,$(MAKECMDGOALS)) include $(dep_files) endif ifneq (,$(filter-out clean proper realclean distclean check, $(MAKECMDGOALS))) include $(dep_files) endif