2 #XSLTPROC = xsltproc -v
7 DOCBOOK_XSL = ${XSL}docbook
8 DB2LATEX_XSL = ${XSL}db2latex/
9 XSLFOP = /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/
11 #DEVNULL = >>/tmp/debug 2>&1
12 DEVNULL = >/dev/null 2>&1
15 ARTICLES=administration_guide user_guide contribution_guide installation_guide
17 all: clean html html-chunk html-guide pdf
19 html: validate prepare
21 # Generating HTML output
23 @for book in ${BOOKS}; do \
24 echo '# . Generating HTML output for book '$$book; \
25 $(XSLTPROC) --xinclude --output ${TARGET}$$book/$$book.plain.html ${XSL}book_html.xsl ${SRC}$$book.xml; \
26 tar -czf ${TARGET}$$book/$$book.plain.tar.gz ${TARGET}$$book/$$book.plain.html; \
29 @for article in ${ARTICLES}; do \
30 echo '# . Generating HTML output for article '$$article; \
31 $(XSLTPROC) --xinclude --output ${TARGET}$$article/$$article.plain.html ${XSL}article_html.xsl ${SRC}$$article/$$article.xml; \
32 tar -czf ${TARGET}$$article/$$article.plain.tar.gz ${TARGET}$$article/$$article.plain.html; \
38 html-chunk: validate prepare
40 # Generating HTML chunked output
42 @for book in ${BOOKS}; do \
43 echo '# . Generating HTML chunked output for book '$$book; \
44 test -d ${TARGET}$$book/$$book || mkdir ${TARGET}$$book/$$book.chunk; \
45 $(XSLTPROC) --xinclude --stringparam base.dir ${TARGET}$$book/$$book.chunk/ ${XSL}book_html_chunk.xsl ${SRC}$$book.xml ${DEVNULL}; \
46 tar -czf ${TARGET}$$book/$$book.chunk.tar.gz ${TARGET}$$book/$$book.chunk; \
49 @for article in ${ARTICLES}; do \
50 echo '# . Generating HTML chunked output for article '$$article; \
51 test -d ${TARGET}$$article/$$article || mkdir ${TARGET}$$article/$$article.chunk; \
52 $(XSLTPROC) --xinclude --stringparam base.dir ${TARGET}$$article/$$article.chunk/ ${XSL}article_html_chunk.xsl ${SRC}$$article/$$article.xml ${DEVNULL}; \
53 tar -czf ${TARGET}$$article/$$article.chunk.tar.gz ${TARGET}$$article/$$article.chunk; \
59 # This guide is the online guide, it is generated as chunked document
60 # and saved in /usr/share/gforge/www/help/guide/
61 html-guide: $(SRC)/user_guide/user_guide.xml
62 rm -f guide/ug_* guide/bk*
63 $(XSLTPROC) --xinclude --stringparam use.id.as.filename 1 --stringparam chunk.section.depth 2 --stringparam chunker.output.indent yes --stringparam chunker.output.encoding UTF-8 --stringparam base.dir guide/ --stringparam html.stylesheet docbook.css ${XSL}article_html_chunk.xsl $<
64 cp css/docbook.css guide/docbook.css
65 # rm -f guide/images/*
66 # cp -p images/* guide/images/
68 pdffop: validate prepare
70 # Generating PDF output
72 # Inspired from Alain Peyrat suggestion
73 #xsltproc --xinclude -o tmp.fo $(XSL)/fo-stylesheet.xsl $(XML)/user_guide/user_guide_full.xml
74 #$(FOP) -fo tmp.fo -pdf help_guide/user_guide.pdf
75 @for book in ${BOOKS}; do \
76 echo '# . Generating PDF output for book '$$book; \
77 $(XSLTPROC) --xinclude --output ${TARGET}$$book/$$book.fo ${XSLFOP}docbook.xsl ${SRC}$$book.xml ${DEVNULL}; \
78 (cd ${TARGET}$$book; $(FOP) -fo $$book.fo -pdf $$book.pdf ${DEVNULL};); \
81 @for article in ${ARTICLES}; do \
82 echo '# . Generating PDF output for article '$$article; \
83 $(XSLTPROC) --xinclude --output ${TARGET}$$article/$$article.fo ${XSLFOP}docbook.xsl ${SRC}$$article/$$article.xml ${DEVNULL}; \
84 (cd ${TARGET}$$article; $(FOP) -fo $$article.fo -pdf $$article.pdf ${DEVNULL};); \
92 # Generating PDF output
94 @for book in ${BOOKS}; do \
95 echo '# . Generating PDF output for book '$$book; \
96 $(XSLTPROC) --xinclude --output ${TARGET}$$book/$$book.tex ${XSL}book_pdf.xsl ${SRC}$$book.xml ${DEVNULL}; \
97 (cd ${TARGET}$$book; pdflatex -interaction=batchmode $$book.tex ${DEVNULL};); \
98 (cd ${TARGET}$$book; pdflatex -interaction=batchmode $$book.tex ${DEVNULL};); \
99 (cd ${TARGET}$$book; pdflatex -interaction=batchmode $$book.tex ${DEVNULL};); \
100 (cd ${TARGET}$$book; rm -f *.aux *.glo *.idx *.log *.out *.tex *.toc ${DEVNULL};); \
103 @for article in ${ARTICLES}; do \
104 echo '# . Generating PDF output for article '$$article; \
105 $(XSLTPROC) --xinclude --output ${TARGET}$$article/$$article.tex ${XSL}article_pdf.xsl ${SRC}$$article/$$article.xml ${DEVNULL}; \
106 (cd ${TARGET}$$article; pdflatex -interaction=batchmode $$article.tex ${DEVNULL};); \
107 (cd ${TARGET}$$article; pdflatex -interaction=batchmode $$article.tex ${DEVNULL};); \
108 (cd ${TARGET}$$article; pdflatex -interaction=batchmode $$article.tex ${DEVNULL};); \
109 (cd ${TARGET}$$article; rm -f *.aux *.glo *.idx *.log *.out *.tex *.toc ${DEVNULL};); \
117 # Preparing build environment
119 @test -d ${TARGET} || mkdir -p ${TARGET};
120 @for book in ${BOOKS}; do \
121 test -d ${TARGET}$$book || mkdir ${TARGET}$$book; \
123 @for article in ${ARTICLES}; do \
124 test -d ${TARGET}$$article || mkdir ${TARGET}$$article; \
131 # Validating documents
133 @for book in ${BOOKS}; do \
134 if (xmllint --xinclude --noout --postvalid ${SRC}$$book.xml ${DEVNULL}); then \
135 echo '# . Validating book '$$book' : [ OK ]'; \
137 echo '# . Validating book '$$book' : [ ERROR ]'; \
139 echo '# ERROR : please check your docbook documents using xmllint first'; \
144 @for article in ${ARTICLES}; do \
145 if (xmllint --xinclude --noout --postvalid ${SRC}$$article/$$article.xml ${DEVNULL}); then \
146 echo '# . Validating article '$$article' : [ OK ]'; \
148 echo '# . Validating article '$$article' : [ ERROR ]'; \
150 echo '# ERROR : please check your docbook documents using xmllint first'; \
161 # Cleaning build environment
170 # Hard cleaning build environment
172 @[ -L xsl/docbook ] && rm xsl/docbook || true
173 @[ -L xsl/db2latex/xsl ] && rm xsl/db2latex/xsl || true
174 @[ -d xsl/db2latex ] && rmdir xsl/db2latex || true
178 debian: debianhtml debianpdf
180 debianhtml: docbook-xml docbook-xsl libxml2-utils xsltproc
181 @echo "=====> Link to docbook"
182 @if [ ! -L $(DOCBOOK_XSL) ]; then \
183 if [ -d /usr/share/xml/docbook/stylesheet/nwalsh ]; then \
184 ln -s /usr/share/xml/docbook/stylesheet/nwalsh $(DOCBOOK_XSL) ; \
185 elif [ -d /usr/share/xml/docbook/stylesheet/docbook-xsl ]; then \
186 ln -s /usr/share/xml/docbook/stylesheet/docbook-xsl $(DOCBOOK_XSL) ; \
189 echo "docbook link already done" ; \
194 debianpdf: xsltproc fop
197 docbook-xml: /usr/share/xml/docbook
198 docbook-xsl: /usr/share/doc/docbook-xsl
199 libxml2-utils: /usr/bin/xmllint
200 xsltproc: /usr/bin/xsltproc
203 /usr/share/xml/docbook:
204 @echo "=====> Intalling necessary docbook-xml package"
205 @sudo apt-get install docbook-xml
207 /usr/share/doc/docbook-xsl:
208 @echo "=====> Intalling necessary docbook-xsl package"
209 @sudo apt-get install docbook-xsl
212 @echo "=====> Intalling necessary xmllint package"
213 @sudo apt-get install libxml2-utils
216 @echo "=====> Intalling necessary xsltproc package"
217 @sudo apt-get install xsltproc
220 @echo "=====> Intalling necessary fop package"
221 @sudo apt-get install fop