Whamcloud - gitweb
LUDOC-6 Add Makefile with check, pdf, html targets
[doc/manual.git] / Makefile
1 SRC_XML=$(wildcard *.xml)
2 SRC_IMG=$(wildcard figures/*.png)
3 SRCS=$(SRC_XML) $(SRC_IMG)
4
5 TGT_BASE=lustre_manual
6
7 RNG_LIN=/usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
8 RNG_MAC=/opt/local/share/xml/docbook/5.0/rng/docbookxi.rng
9 RNG=$(or $(shell ls $(RNG_LIN) 2> /dev/null), \
10          $(shell ls $(RNG_MAC) 2> /dev/null))
11 XSL_LIN=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
12 XSL_MAC=/opt/local/share/xsl/docbook-xsl
13 XSL=$(or $(shell ls -d $(XSL_LIN) 2> /dev/null), \
14          $(shell ls -d $(XSL_MAC) 2> /dev/null))
15
16 .PHONY: check
17 check: $(SRC_XML)
18         xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
19
20 # Note: can't use "suffix" instead of "subst", because it keeps the '.'
21 $(TGT_BASE).html $(TGT_BASE).fo: $(SRCS)
22         xsltproc --stringparam fop1.extensions  1 \
23                 --stringparam section.label.includes.component.label 1 \
24                 --stringparam section.autolabel 1 \
25                 --stringparam chapter.autolabel 1 \
26                 --stringparam appendix.autolabel 1 \
27                 --xinclude -o $@ $(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl ./index.xml
28
29 $(TGT_BASE).pdf: $(TGT_BASE).fo
30                 fop $< $@
31
32 .PHONY: html
33 html: $(TGT_BASE).html
34
35 .PHONY: pdf
36 pdf: $(TGT_BASE).pdf
37
38 .PHONY: push
39 push:
40         git push ssh://review.whamcloud.com:29418/doc/manual HEAD:refs/for/master