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))
28 PRIMARYXSL=$(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl
31 all: clean check xhtml html pdf epub
35 xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
37 # Note: can't use "suffix" instead of "subst", because it keeps the '.'
38 # Note: xsl:import is resolved at compile time, so the primary xsl
39 # is substituted into the custom xsl with sed before compliation.
40 $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).epub: $(SRCS)
41 sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle.xsl | \
42 xsltproc --xinclude -o $@ - ./index.xml
44 $(TGT_BASE).fo: $(SRCS)
45 sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle_fo.xsl | \
46 xsltproc --xinclude -o $@ - ./index.xml
49 $(TGT_BASE).pdf: $(TGT_BASE).fo
53 html: $(TGT_BASE).html
56 xhtml: $(TGT_BASE).xhtml
62 epub: $(TGT_BASE).epub
63 echo "application/epub+zip" > mimetype
64 cp -r ./figures ./OEBPS/
66 cp ./style/manual.css ./OEBPS/style/
67 zip -0Xq $(TGT_BASE).epub mimetype
68 zip -Xr9D $(TGT_BASE).epub OEBPS/*
69 zip -Xr9D $(TGT_BASE).epub META-INF/*
72 # get the git hash for the last successful build of the manual
73 .PHONY: mastermanual.revision
74 mastermanual.revision:
75 wget -O mastermanual.index $(MASTER_URL) || wget -O mastermanual.index $(MASTER_URL_LAB)
76 awk '/Revision/ { print $$NF }' mastermanual.index > mastermanual.revision
78 # only fetch the full manual if we don't have it or the manual changed
79 $(TGT_MASTER).xhtml: mastermanual.revision
80 if ! cmp -s mastermanual.revision $(TGT_MASTER).revision ; then\
81 (wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) || \
82 wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML_LAB)) && \
83 mv mastermanual.revision $(TGT_MASTER).revision;\
87 diff: $(TGT_BASE).xhtml $(TGT_MASTER).xhtml
88 ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff.html
93 git push ssh://review.whamcloud.com:29418/doc/manual HEAD:refs/for/master
97 rm -f $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).pdf\
98 mastermanual.revision mastermanual.index mimetype\
99 $(TGT_BASE).diff.html $(TGT_BASE).epub $(TGT_BASE).fo
100 rm -rf ./META-INF ./OEBPS