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
12 CHUNKED_HTML=chunked-html
15 RNG_UBN=/usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
16 RNG_REL=/usr/share/xml/docbook5/schema/rng/5.0/docbookxi.rng
17 RNG_BREW=/usr/local/opt/docbook/docbook/xml/5.0/rng/docbookxi.rng
18 RNG_MAC=/opt/local/share/xml/docbook/5.0/rng/docbookxi.rng
19 RNG=$(or $(shell ls $(RNG_UBN) 2> /dev/null), \
20 $(shell ls $(RNG_REL) 2> /dev/null), \
21 $(shell ls $(RNG_BREW) 2> /dev/null),\
22 $(shell ls $(RNG_MAC) 2> /dev/null))
23 XSL_UBN=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
24 XSL_REL=/usr/share/sgml/docbook/xsl-ns-stylesheets-1.75.2
25 XSL_F16=/usr/share/sgml/docbook/xsl-ns-stylesheets
26 XSL_SLE=/usr/share/xml/docbook/stylesheet/nwalsh5/current
27 XSL_BREW=/usr/local/opt/docbook-xsl/docbook-xsl
28 XSL_MAC=/opt/local/share/xsl/docbook-xsl
29 XSL_MAC2=/opt/local/share/xsl/docbook-xsl-nons
30 XSL=$(or $(shell ls -d $(XSL_UBN) 2> /dev/null), \
31 $(shell ls -d $(XSL_REL) 2> /dev/null), \
32 $(shell ls -d $(XSL_F16) 2> /dev/null), \
33 $(shell ls -d $(XSL_SLE) 2> /dev/null), \
34 $(shell ls -d $(XSL_BREW) 2> /dev/null),\
35 $(shell ls -d $(XSL_MAC) 2> /dev/null),\
36 $(shell ls -d $(XSL_MAC2) 2> /dev/null))
37 PRIMARYXSL=$(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl
38 PRIMARYCHUNKXSL=$(XSL)/html/chunkfast.xsl
41 all: clean check xhtml html chunked-html pdf epub
45 xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
47 # Note: can't use "suffix" instead of "subst", because it keeps the '.'
48 # Note: xsl:import is resolved at compile time, so the primary xsl
49 # is substituted into the custom xsl with sed before compliation.
50 $(CHUNKED_HTML)/%.html: $(SRCS)
51 sed -e 's;PRIMARYXSL;${PRIMARYCHUNKXSL};' ./style/customstyle.xsl | \
52 xsltproc --xinclude -o ${CHUNKED_HTML}/ - ./index.xml
54 $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).epub: $(SRCS)
55 sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle.xsl | \
56 xsltproc --xinclude -o $@ - ./index.xml
58 $(TGT_BASE).fo: $(SRCS)
59 sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle_fo.xsl | \
60 xsltproc --xinclude -o $@ - ./index.xml
63 $(TGT_BASE).pdf: $(TGT_BASE).fo
67 html: $(TGT_BASE).html
70 xhtml: $(TGT_BASE).xhtml
76 epub: $(TGT_BASE).epub
77 echo "application/epub+zip" > mimetype
78 cp -r ./figures ./OEBPS/
80 cp ./style/manual.css ./OEBPS/style/
81 zip -0Xq $(TGT_BASE).epub mimetype
82 zip -Xr9D $(TGT_BASE).epub OEBPS/*
83 zip -Xr9D $(TGT_BASE).epub META-INF/*
86 chunked-html: $(CHUNKED_HTML)/%.html
87 cp -r ./figures ./${CHUNKED_HTML}
90 # get the git hash for the last successful build of the manual
91 .PHONY: mastermanual.revision
92 mastermanual.revision:
93 wget -O mastermanual.index $(MASTER_URL) || wget -O mastermanual.index $(MASTER_URL_LAB)
94 awk '/Revision/ { print $$NF }' mastermanual.index > mastermanual.revision
96 # only fetch the full manual if we don't have it or the manual changed
97 $(TGT_MASTER).xhtml: mastermanual.revision
98 if ! cmp -s mastermanual.revision $(TGT_MASTER).revision ; then\
99 (wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) || \
100 wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML_LAB)) && \
101 mv mastermanual.revision $(TGT_MASTER).revision;\
105 diff: $(TGT_BASE).xhtml $(TGT_MASTER).xhtml
106 ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff.html
111 git push ssh://review.whamcloud.com:29418/doc/manual HEAD:refs/for/master
115 rm -f $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).pdf\
116 mastermanual.revision mastermanual.index mimetype\
117 $(TGT_BASE).diff.html $(TGT_BASE).epub $(TGT_BASE).fo
118 rm -rf ./META-INF ./OEBPS ./$(TGT_BASE)