1 SRC_XML=$(wildcard *.xml)
2 SRC_IMG=$(wildcard figures/*.png)
3 SRCS=$(SRC_XML) $(SRC_IMG)
7 MASTER_URL=http://build.whamcloud.com/job/lustre-manual/lastSuccessfulBuild/
8 MASTER_URL_LAB=http://build.lab.whamcloud.com:8080/job/lustre-manual/lastSuccessfulBuild/
9 MASTER_XHTML=$(MASTER_URL)/artifact/$(TGT_BASE).xhtml
10 MASTER_XHTML_LAB=$(MASTER_URL_LAB)/artifact/$(TGT_BASE).xhtml
11 TGT_MASTER=$(TMP)/mastermanual
14 RNG_UBN=/usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
15 RNG_REL=/usr/share/xml/docbook5/schema/rng/5.0/docbookxi.rng
16 RNG_MAC=/opt/local/share/xml/docbook/5.0/rng/docbookxi.rng
17 RNG=$(or $(shell ls $(RNG_UBN) 2> /dev/null), \
18 $(shell ls $(RNG_REL) 2> /dev/null), \
19 $(shell ls $(RNG_MAC) 2> /dev/null))
20 XSL_UBN=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
21 XSL_REL=/usr/share/sgml/docbook/xsl-ns-stylesheets-1.75.2
22 XSL_F16=/usr/share/sgml/docbook/xsl-ns-stylesheets
23 XSL_MAC=/opt/local/share/xsl/docbook-xsl
24 XSL=$(or $(shell ls -d $(XSL_UBN) 2> /dev/null), \
25 $(shell ls -d $(XSL_REL) 2> /dev/null), \
26 $(shell ls -d $(XSL_F16) 2> /dev/null), \
27 $(shell ls -d $(XSL_MAC) 2> /dev/null))
30 all: clean check xhtml html pdf epub
34 xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
36 # Note: can't use "suffix" instead of "subst", because it keeps the '.'
37 $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).epub $(TGT_BASE).fo: $(SRCS)
38 xsltproc --stringparam fop1.extensions 1 \
39 --stringparam section.label.includes.component.label 1 \
40 --stringparam section.autolabel 1 \
41 --stringparam chapter.autolabel 1 \
42 --stringparam appendix.autolabel 1 \
43 --xinclude -o $@ $(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl ./index.xml
45 $(TGT_BASE).pdf: $(TGT_BASE).fo
49 html: $(TGT_BASE).html
52 xhtml: $(TGT_BASE).xhtml
58 epub: $(TGT_BASE).epub
59 echo "application/epub+zip" > mimetype
60 cp -r ./figures ./OEBPS/
61 zip -0Xq $(TGT_BASE).epub mimetype
62 zip -Xr9D $(TGT_BASE).epub OEBPS/*
63 zip -Xr9D $(TGT_BASE).epub META-INF/*
66 # get the git hash for the last successful build of the manual
67 .PHONY: mastermanual.revision
68 mastermanual.revision:
69 wget -O mastermanual.index $(MASTER_URL) || wget -O mastermanual.index $(MASTER_URL_LAB)
70 awk '/Revision/ { print $$NF }' mastermanual.index > mastermanual.revision
72 # only fetch the full manual if we don't have it or the manual changed
73 $(TGT_MASTER).xhtml: mastermanual.revision
74 if ! cmp -s mastermanual.revision $(TGT_MASTER).revision ; then\
75 (wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) || \
76 wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML_LAB)) && \
77 mv mastermanual.revision $(TGT_MASTER).revision;\
81 diff: $(TGT_BASE).xhtml $(TGT_MASTER).xhtml
82 ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff.html
87 git push ssh://review.whamcloud.com:29418/doc/manual HEAD:refs/for/master
91 rm -f $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).pdf\
92 mastermanual.revision mastermanual.index mimetype\
93 $(TGT_BASE).diff.html $(TGT_BASE).epub
94 rm -rf ./META-INF ./OEBPS