4 DOCBOOK_XSL = ${XSL}docbook/
5 DB2LATEX_XSL = ${XSL}db2latex/
6 #DEVNULL = >>/tmp/debug 2>&1
10 ARTICLES=administration_guide user_guide contribution_guide installation_guide
12 all: clean html html-chunk html-guide pdf
14 html: validate prepare
16 # Generating HTML output
18 @for book in ${BOOKS}; do \
19 echo '# . Generating HTML output for book '$$book; \
20 xsltproc --xinclude --output ${TARGET}$$book/$$book.plain.html ${XSL}book_html.xsl ${SRC}$$book.xml; \
21 tar -czf ${TARGET}$$book/$$book.plain.tar.gz ${TARGET}$$book/$$book.plain.html; \
24 @for article in ${ARTICLES}; do \
25 echo '# . Generating HTML output for article '$$article; \
26 xsltproc --xinclude --output ${TARGET}$$article/$$article.plain.html ${XSL}article_html.xsl ${SRC}$$article/$$article.xml; \
27 tar -czf ${TARGET}$$article/$$article.plain.tar.gz ${TARGET}$$article/$$article.plain.html; \
33 html-chunk: validate prepare
35 # Generating HTML chunked output
37 @for book in ${BOOKS}; do \
38 echo '# . Generating HTML chunked output for book '$$book; \
39 test -d ${TARGET}$$book/$$book || mkdir ${TARGET}$$book/$$book.chunk; \
40 xsltproc --xinclude --stringparam base.dir ${TARGET}$$book/$$book.chunk/ ${XSL}book_html_chunk.xsl ${SRC}$$book.xml ${DEVNULL}; \
41 tar -czf ${TARGET}$$book/$$book.chunk.tar.gz ${TARGET}$$book/$$book.chunk; \
44 @for article in ${ARTICLES}; do \
45 echo '# . Generating HTML chunked output for article '$$article; \
46 test -d ${TARGET}$$article/$$article || mkdir ${TARGET}$$article/$$article.chunk; \
47 xsltproc --xinclude --stringparam base.dir ${TARGET}$$article/$$article.chunk/ ${XSL}article_html_chunk.xsl ${SRC}$$article/$$article.xml ${DEVNULL}; \
48 tar -czf ${TARGET}$$article/$$article.chunk.tar.gz ${TARGET}$$article/$$article.chunk; \
54 # This guide is the online guide, it is generated as chunked document
55 # and saved in /usr/share/gforge/www/help/guide/
56 html-guide: $(SRC)/user_guide/user_guide.xml
57 rm -f guide/ug_* guide/bk*
58 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 $<
59 cp css/docbook.css guide/docbook.css
60 # rm -f guide/images/*
61 # cp -p images/* guide/images/
65 # Generating PDF output
67 @for book in ${BOOKS}; do \
68 echo '# . Generating PDF output for book '$$book; \
69 xsltproc --xinclude --output ${TARGET}$$book/$$book.tex ${XSL}book_pdf.xsl ${SRC}$$book.xml ${DEVNULL}; \
70 (cd ${TARGET}$$book; pdflatex -interaction=batchmode $$book.tex ${DEVNULL};); \
71 (cd ${TARGET}$$book; pdflatex -interaction=batchmode $$book.tex ${DEVNULL};); \
72 (cd ${TARGET}$$book; pdflatex -interaction=batchmode $$book.tex ${DEVNULL};); \
73 (cd ${TARGET}$$book; rm -f *.aux *.glo *.idx *.log *.out *.tex *.toc ${DEVNULL};); \
76 @for article in ${ARTICLES}; do \
77 echo '# . Generating PDF output for article '$$article; \
78 xsltproc --xinclude --output ${TARGET}$$article/$$article.tex ${XSL}article_pdf.xsl ${SRC}$$article/$$article.xml ${DEVNULL}; \
79 (cd ${TARGET}$$article; pdflatex -interaction=batchmode $$article.tex ${DEVNULL};); \
80 (cd ${TARGET}$$article; pdflatex -interaction=batchmode $$article.tex ${DEVNULL};); \
81 (cd ${TARGET}$$article; pdflatex -interaction=batchmode $$article.tex ${DEVNULL};); \
82 (cd ${TARGET}$$article; rm -f *.aux *.glo *.idx *.log *.out *.tex *.toc ${DEVNULL};); \
90 # Preparing build environment
92 @test -d ${TARGET} || mkdir ${TARGET};
93 @for book in ${BOOKS}; do \
94 test -d ${TARGET}$$book || mkdir ${TARGET}$$book; \
96 @for article in ${ARTICLES}; do \
97 test -d ${TARGET}$$article || mkdir ${TARGET}$$article; \
104 # Validating documents
106 @for book in ${BOOKS}; do \
107 if (xmllint --xinclude --noout --postvalid ${SRC}$$book.xml ${DEVNULL}); then \
108 echo '# . Validating book '$$book' : [ OK ]'; \
110 echo '# . Validating book '$$book' : [ ERROR ]'; \
112 echo '# ERROR : please check your docbook documents using xmllint first'; \
117 @for article in ${ARTICLES}; do \
118 if (xmllint --xinclude --noout --postvalid ${SRC}$$article/$$article.xml ${DEVNULL}); then \
119 echo '# . Validating article '$$article' : [ OK ]'; \
121 echo '# . Validating article '$$article' : [ ERROR ]'; \
123 echo '# ERROR : please check your docbook documents using xmllint first'; \
134 # Cleaning build environment
139 @[ -L xsl/docbook ] && rm xsl/docbook || true
140 @[ -L xsl/db2latex/xsl ] && rm xsl/db2latex/xsl || true
141 @[ -d xsl/db2latex ] && rmdir xsl/db2latex || true
144 debian: debianhtml debianpdf
147 @echo "=====> Intalling necessary packages"
148 @sudo apt-get install docbook-xml docbook-xsl libxml2-utils xsltproc
149 @echo "=====> Link to docbook"
150 @[ ! -L xsl/docbook ] && ln -s /usr/share/xml/docbook/stylesheet/nwalsh xsl/docbook || echo "docbook link already done"
154 @echo "=====> Intalling necessary packages"
155 @sudo apt-get install db2latex-xsl tetex-extra latex-ucs
156 @echo "Making db2latex dir"
157 @[ ! -d xsl/db2latex ] && mkdir xsl/db2latex || echo "db2latex dir already done"
158 @echo "=====> Link to docbook"
159 @[ ! -L xsl/db2latex/xsl ] && ln -s /usr/share/xml/docbook/stylesheet/db2latex/latex xsl/db2latex/xsl || echo "docbook link already done"