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
29 PRIMARYCHUNKXSL=$(XSL)/html/chunkfast.xsl
32 all: clean check xhtml html chunked-html pdf epub
36 xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
38 # Note: can't use "suffix" instead of "subst", because it keeps the '.'
39 # Note: xsl:import is resolved at compile time, so the primary xsl
40 # is substituted into the custom xsl with sed before compliation.
41 $(TGT_BASE)/%.html: $(SRCS)
42 sed -e 's;PRIMARYXSL;${PRIMARYCHUNKXSL};' ./style/customstyle.xsl | \
43 xsltproc --xinclude -o ${TGT_BASE}/ - ./index.xml
45 $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).epub: $(SRCS)
46 sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle.xsl | \
47 xsltproc --xinclude -o $@ - ./index.xml
49 $(TGT_BASE).fo: $(SRCS)
50 sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle_fo.xsl | \
51 xsltproc --xinclude -o $@ - ./index.xml
54 $(TGT_BASE).pdf: $(TGT_BASE).fo
58 html: $(TGT_BASE).html
61 xhtml: $(TGT_BASE).xhtml
67 epub: $(TGT_BASE).epub
68 echo "application/epub+zip" > mimetype
69 cp -r ./figures ./OEBPS/
71 cp ./style/manual.css ./OEBPS/style/
72 zip -0Xq $(TGT_BASE).epub mimetype
73 zip -Xr9D $(TGT_BASE).epub OEBPS/*
74 zip -Xr9D $(TGT_BASE).epub META-INF/*
77 chunked-html: $(TGT_BASE)/%.html
78 cp -r ./figures ./${TGT_BASE}
81 # get the git hash for the last successful build of the manual
82 .PHONY: mastermanual.revision
83 mastermanual.revision:
84 wget -O mastermanual.index $(MASTER_URL) || wget -O mastermanual.index $(MASTER_URL_LAB)
85 awk '/Revision/ { print $$NF }' mastermanual.index > mastermanual.revision
87 # only fetch the full manual if we don't have it or the manual changed
88 $(TGT_MASTER).xhtml: mastermanual.revision
89 if ! cmp -s mastermanual.revision $(TGT_MASTER).revision ; then\
90 (wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) || \
91 wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML_LAB)) && \
92 mv mastermanual.revision $(TGT_MASTER).revision;\
96 diff: $(TGT_BASE).xhtml $(TGT_MASTER).xhtml
97 ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff.html
102 git push ssh://review.whamcloud.com:29418/doc/manual HEAD:refs/for/master
106 rm -f $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).pdf\
107 mastermanual.revision mastermanual.index mimetype\
108 $(TGT_BASE).diff.html $(TGT_BASE).epub $(TGT_BASE).fo
109 rm -rf ./META-INF ./OEBPS ./$(TGT_BASE)