Browse Source

- the main makefile containing rules for building documentation
- tracks dependencies
- uses xsltproc to produce XHTML and plaintext documentation from
docbook

Jan Janak 20 năm trước cách đây
mục cha
commit
be65e4078f
1 tập tin đã thay đổi với 93 bổ sung0 xóa
  1. 93 0
      Makefile.doc

+ 93 - 0
Makefile.doc

@@ -0,0 +1,93 @@
+#
+# $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 ?= ../../..
+
+#
+# Stylesheet used to generate dependencies from XML files
+#
+DEP_XSL ?= $(ROOT_DIR)/doc/stylesheets/dep.xsl
+
+#
+# Default stylesheet used to generate HTML
+#
+XHTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/xhtml.xsl
+
+#
+# Stylesheet used to generate plain text documents,
+# this is usually the one used for xhtml
+#
+TXT_XSL ?= $(XHTML_XSL)
+
+#
+# Enable document validation by default
+# 
+VALIDATE ?= 1
+
+LYNX     ?= lynx
+DIA      ?= dia
+XSLTPROC ?= xsltproc
+
+LYNX_FLAGS     ?= -nolist
+DIA_ARGS       ?=
+XSLTPROC_FLAGS ?=
+
+ifeq ($(VALIDATE), 0)
+	override XSLTPROC_FLAGS := $(XSLTPROC_FLAGS) --novalid
+endif
+
+alldep = Makefile $(ROOT_DIR)/Makefile.doc $(ROOT_DIR)/doc/stylesheets/dep.xsl
+
+all: xhtml
+
+dep_files = $(addsuffix .d, $(DOCUMENTS))
+xhtml_files = $(addsuffix .xhtml, $(DOCUMENTS))
+txt_files = $(addsuffix .txt, $(DOCUMENTS))
+
+
+xhtml: $(xhtml_files)
+txt: $(txt_files)
+
+%.xhtml: %.xml $(alldep) $(XHTML_XSL) 
+	$(XSLTPROC) $(XSLTPROC_FLAGS) --xinclude -o $@ $(XHTML_XSL) $<
+
+%.txt: %.xml $(alldep)
+	$(XSLTPROC) $(XSLTPROC_FLAGS) --xinclude $(TXT_XSL) $< | \
+	$(LYNX) $(LYNX_FLAGS) -stdin -dump $< > $@
+
+%.png: %.dia $(alldep)
+	$(DIA) $(DIA_ARGS) -t png -e $@ $<
+
+%.d: %.xml $(alldep) 
+	echo -n $@ $< | sed -e 's/ml/html: /' > $@
+	$(XSLTPROC) $(XSLTPROC_FLAGS) --novalid $(DEP_XSL) $< >> $@ 
+
+
+.PHONY: clean
+clean:
+	rm -f $(txt_files)
+	rm -f $(xhtml_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, $(MAKECMDGOALS)))
+include $(dep_files)
+endif
+