Whamcloud - gitweb
LUDOC-6 Add Makefile with check, pdf, html targets 63/1063/2
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 6 Jul 2011 20:16:10 +0000 (14:16 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 6 Jul 2011 22:52:19 +0000 (16:52 -0600)
Add a Makefile which will, by default, check the XML of the manual
for structural errors, or build a .html or .pdf version of the
Lustre manual.

It checks for Docbook style sheets on both Linux and MacOS.

Change-Id: I1583a0849ef14299a3df37328f4acc2a55a00fac
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..441b96f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+SRC_XML=$(wildcard *.xml)
+SRC_IMG=$(wildcard figures/*.png)
+SRCS=$(SRC_XML) $(SRC_IMG)
+
+TGT_BASE=lustre_manual
+
+RNG_LIN=/usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
+RNG_MAC=/opt/local/share/xml/docbook/5.0/rng/docbookxi.rng
+RNG=$(or $(shell ls $(RNG_LIN) 2> /dev/null), \
+        $(shell ls $(RNG_MAC) 2> /dev/null))
+XSL_LIN=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
+XSL_MAC=/opt/local/share/xsl/docbook-xsl
+XSL=$(or $(shell ls -d $(XSL_LIN) 2> /dev/null), \
+        $(shell ls -d $(XSL_MAC) 2> /dev/null))
+
+.PHONY: check
+check: $(SRC_XML)
+       xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
+
+# Note: can't use "suffix" instead of "subst", because it keeps the '.'
+$(TGT_BASE).html $(TGT_BASE).fo: $(SRCS)
+       xsltproc --stringparam fop1.extensions  1 \
+               --stringparam section.label.includes.component.label 1 \
+               --stringparam section.autolabel 1 \
+               --stringparam chapter.autolabel 1 \
+               --stringparam appendix.autolabel 1 \
+               --xinclude -o $@ $(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl ./index.xml
+
+$(TGT_BASE).pdf: $(TGT_BASE).fo
+               fop $< $@
+
+.PHONY: html
+html: $(TGT_BASE).html
+
+.PHONY: pdf
+pdf: $(TGT_BASE).pdf
+
+.PHONY: push
+push:
+       git push ssh://review.whamcloud.com:29418/doc/manual HEAD:refs/for/master