Module: sip-router Branch: master Commit: 371312a736015cd3ca654b72729d3385e56fcc69 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=371312a7...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Tue Apr 21 21:47:10 2009 +0200
makefile: K mode for documentation generation
- K has some extra parameters to XSLTPROC - new option to be able to set the path for css file used inside generated html
---
Makefile.doc | 338 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 177 insertions(+), 161 deletions(-)
diff --git a/Makefile.doc b/Makefile.doc index 4cc6791..c6e7cab 100644 --- a/Makefile.doc +++ b/Makefile.doc @@ -1,161 +1,177 @@ -#
-# $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
-
+# +# $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 + +# +# K docbook style +# +ifeq ($(DOCBOOK_MODE), k) + HTML_CSS=/css/kam-module-docbook.css + XSLTPROC_FLAGS+= --stringparam section.autolabel 1 \ + --stringparam section.label.includes.component.label 1 \ + --stringparam generate.toc "book toc,title,figure,table,example" +endif + +# +# Default CSS used in generated HTMLs +# +HTML_CSS ?= ser.css + +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" \ + --stringparam html.stylesheet $(HTML_CSS) \ + $(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 $(HTML_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 +