blob: ab039e0ee6100f8345b6c72ba455b0d86e6af557 [file] [log] [blame]
sewardjd6bfc842005-07-25 23:01:43 +00001
2##-------------------------------------------------------------
3## HACK: stuff to avoid making the print docs if installing the
4## tools to do so is impractical / too difficult
5##-------------------------------------------------------------
6
7# Comment out the next line to skip building print docs. The default
8# is not to skip building print docs. Note, after changing it
9# you of course need to re-run configure to make it take effect.
njn54cd5602005-09-30 02:17:40 +000010BUILD_ALL_DOCS=yes
sewardjd6bfc842005-07-25 23:01:43 +000011
12##-------------------------------------------------------------
13## END OF HACK
14##-------------------------------------------------------------
15
16
njnf7c00b12005-07-19 21:46:19 +000017SUBDIRS = xml lib images internals
sewardjde4a1d02002-03-22 01:27:54 +000018
njnf7c00b12005-07-19 21:46:19 +000019EXTRA_DIST = README
njn3e986b22004-11-30 10:43:45 +000020
sewardjd6bfc842005-07-25 23:01:43 +000021
njn3e986b22004-11-30 10:43:45 +000022##-------------------------------------------------------------------
23## Below here is more ordinary make stuff...
24##-------------------------------------------------------------------
njn804947e2005-09-13 04:10:45 +000025myxmldir = $(top_srcdir)/docs/xml
26myimgdir = $(top_srcdir)/docs/images
27mylibdir = $(top_srcdir)/docs/lib
28
29myhtmldir = $(top_builddir)/docs/html
30myprintdir = $(top_builddir)/docs/print
njn3e986b22004-11-30 10:43:45 +000031
de252c6142005-11-27 04:10:00 +000032websitedir = $(top_builddir)/docs/website
33valkyriedir = $(top_builddir)/docs/vg-html
34downloadsdir = $(top_builddir)/docs/downloads
35vgdir = $(top_builddir)/docs/valgrind
36
njn3e986b22004-11-30 10:43:45 +000037XML_CATALOG_FILES = /etc/xml/catalog
38
39# file to log print output to
40LOGFILE = print.log
41
42# validation stuff
43XMLLINT = xmllint
debad57fc2005-12-03 22:33:29 +000044LINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent
45# validate with docbook 4.3 'cos it supports xml:base natively
46VALID_FLAGS = --dtdvalid http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
njn3e986b22004-11-30 10:43:45 +000047XMLLINT_FLAGS = $(LINT_FLAGS) $(VALID_FLAGS)
48
49# stylesheet processor
50XSLTPROC = xsltproc
debad57fc2005-12-03 22:33:29 +000051XSLTPROC_FLAGS = --nonet --xinclude
njn3e986b22004-11-30 10:43:45 +000052
53# stylesheets
njn804947e2005-09-13 04:10:45 +000054XSL_HTML_CHUNK_STYLE = $(mylibdir)/vg-html-chunk.xsl
njn804947e2005-09-13 04:10:45 +000055XSL_FO_STYLE = $(mylibdir)/vg-fo.xsl
de9bec93c2005-11-25 05:36:48 +000056XSL_TEXT_STYLE = $(mylibdir)/vg-faq2txt.xsl
de252c6142005-11-27 04:10:00 +000057XSL_WEBSITE_STYLE = $(mylibdir)/vg-html-website.xsl
debad57fc2005-12-03 22:33:29 +000058XSL_MAN_STYLE = /usr/share/xml/docbook/stylesheet/nwalsh/1.69.0/manpages/docbook.xsl
njn3e986b22004-11-30 10:43:45 +000059
debad57fc2005-12-03 22:33:29 +000060all-docs: FAQ.txt man-page html-docs print-docs
njn3e986b22004-11-30 10:43:45 +000061
62valid:
njn804947e2005-09-13 04:10:45 +000063 $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml
njn3e986b22004-11-30 10:43:45 +000064
njn15d7c342005-09-30 01:43:32 +000065# The text version of the FAQ.
de9bec93c2005-11-25 05:36:48 +000066FAQ.txt:
67 @echo "Generating the text version of the FAQ ..."
68 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
69 $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./FAQ.txt $(XSL_TEXT_STYLE) $(myxmldir)/FAQ.xml
sewardj163566b2005-11-01 03:08:41 +000070
debad57fc2005-12-03 22:33:29 +000071# the valgrind manpage
72man-page:
sewardje60fc582005-12-04 15:00:06 +000073 if test ! -f $(XSL_MAN_STYLE); then \
74 echo "Error: I can't find the file '$(XSL_MAN_STYLE)'"; \
75 echo "Please check where it lives on your system, and" \
76 "amend the line 'XSL_MAN_STYLE = ' in this Makefile."; \
77 exit 1; \
78 fi;
debad57fc2005-12-03 22:33:29 +000079 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
80 $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./ $(XSL_MAN_STYLE) $(myxmldir)/valgrind-manpage.xml
81
de9bec93c2005-11-25 05:36:48 +000082# chunked html, on a chapter-by-chapter basis
njn3e986b22004-11-30 10:43:45 +000083html-docs:
84 @echo "Generating html files..."
njnb0267202005-07-25 21:12:40 +000085 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
njn804947e2005-09-13 04:10:45 +000086 mkdir -p $(myhtmldir) && \
87 /bin/rm -fr $(myhtmldir)/ && \
88 mkdir -p $(myhtmldir)/ && \
89 mkdir -p $(myhtmldir)/images && \
90 cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \
91 cp $(myimgdir)/*.png $(myhtmldir)/images && \
92 $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
njn3e986b22004-11-30 10:43:45 +000093
94# pdf and postscript
95print-docs:
njn804947e2005-09-13 04:10:45 +000096 @echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)...";
njnb0267202005-07-25 21:12:40 +000097 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
njn804947e2005-09-13 04:10:45 +000098 mkdir -p $(myprintdir) && \
99 mkdir -p $(myprintdir)/images && \
100 cp $(myimgdir)/massif-graph-sm.png $(myprintdir)/images && \
101 $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myprintdir)/index.fo $(XSL_FO_STYLE) $(myxmldir)/index.xml && \
102 (cd $(myprintdir) && \
njnb0267202005-07-25 21:12:40 +0000103 ( pdfxmltex index.fo && \
104 pdfxmltex index.fo && \
sewardj163566b2005-11-01 03:08:41 +0000105 pdfxmltex index.fo ) &> $(LOGFILE) < /dev/null && \
njn804947e2005-09-13 04:10:45 +0000106 echo "Generating PS file: $(myprintdir)/index.ps ..." && \
sewardj27eca032005-07-25 17:53:46 +0000107 pdftops index.pdf && \
njnb0267202005-07-25 21:12:40 +0000108 rm -f *.log *.aux *.fo *.out)
njn3e986b22004-11-30 10:43:45 +0000109
110# If the docs have been built, install them. But don't worry if they have
111# not -- developers do 'make install' not from a 'make dist'-ified distro all
112# the time.
sewardjd6bfc842005-07-25 23:01:43 +0000113#
114# Note: this is done at 'make install' time.
115# Note 2: the ifeq/else/endif have to be indented one space
116# because otherwise it seems that automake thinks it should
117# be the one to handle the else/endif parts, not GNU make
118# as we intend.
njn3e986b22004-11-30 10:43:45 +0000119install-data-hook:
120 if test -r html ; then \
sewardje60fc582005-12-04 15:00:06 +0000121 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
122 cp -r html $(DESTDIR)$(datadir)/doc/valgrind; \
njn3e986b22004-11-30 10:43:45 +0000123 fi
sewardjd6bfc842005-07-25 23:01:43 +0000124 ifeq ($(BUILD_ALL_DOCS),yes)
125 if test -r index.pdf ; then \
sewardje60fc582005-12-04 15:00:06 +0000126 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
sewardj645580e2005-07-25 23:36:58 +0000127 cp index.pdf $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.pdf; \
sewardjd6bfc842005-07-25 23:01:43 +0000128 fi
129 if test -r index.ps ; then \
sewardje60fc582005-12-04 15:00:06 +0000130 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
sewardj645580e2005-07-25 23:36:58 +0000131 cp index.ps $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.ps; \
sewardjd6bfc842005-07-25 23:01:43 +0000132 fi
sewardje60fc582005-12-04 15:00:06 +0000133 if test -r valgrind.1 ; then \
134 mkdir -p $(DESTDIR)$(mandir)/man1; \
135 cp valgrind.1 $(DESTDIR)$(mandir)/man1/valgrind.1; \
136 fi
sewardjd6bfc842005-07-25 23:01:43 +0000137 endif
njn3e986b22004-11-30 10:43:45 +0000138
sewardje60fc582005-12-04 15:00:06 +0000139# This is done at 'make dist' time. It builds the html docs, print
140# docs and man page and copies them into the docs/ directory in the
141# tarball.
sewardjd6bfc842005-07-25 23:01:43 +0000142 ifeq ($(BUILD_ALL_DOCS),yes)
sewardje60fc582005-12-04 15:00:06 +0000143dist-hook: FAQ.txt html-docs print-docs man-page
sewardjd6bfc842005-07-25 23:01:43 +0000144 cp -r html $(distdir)
njn15d7c342005-09-30 01:43:32 +0000145 cp FAQ.txt $(distdir)/..
sewardje60fc582005-12-04 15:00:06 +0000146 cp valgrind.1 $(distdir)
sewardjd6bfc842005-07-25 23:01:43 +0000147 cp print/index.pdf $(distdir)
148 cp print/index.ps $(distdir)
149 else
sewardje60fc582005-12-04 15:00:06 +0000150dist-hook: FAQ.txt html-docs man-page
njn15d7c342005-09-30 01:43:32 +0000151 cp FAQ.txt $(distdir)/..
sewardjd6bfc842005-07-25 23:01:43 +0000152 cp -r html $(distdir)
153 endif
njn3e986b22004-11-30 10:43:45 +0000154
155distclean-local:
156 rm -rf html print
njn15d7c342005-09-30 01:43:32 +0000157 rm -f $(top_builddir)/FAQ.txt
de252c6142005-11-27 04:10:00 +0000158
159
160
sewardje60fc582005-12-04 15:00:06 +0000161# -----------------------------------------------------------------------
162# Note: the rest of this file is nothing to do with the normal build
163# tree. The stuff below contains special targets for web-site
164# artefacts.
de252c6142005-11-27 04:10:00 +0000165
166# chunked html with no html/body tags, css, or top nav, to fit into the website
167website-docs:
168 @echo "Generating website html files ..."
169 export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
170 /bin/rm -fr $(websitedir)
171 mkdir -p $(websitedir)
172 $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(websitedir)/ $(XSL_WEBSITE_STYLE) $(myxmldir)/index.xml
173
174# valkyrie carries around her own copy of the valgrind manual
175valkyrie-docs:
176 @echo "Generating a set of valgrind docs for valkyrie..."
177 export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
178 /bin/rm -fr $(valkyriedir)
179 mkdir -p $(valkyriedir)
180 mkdir -p $(valkyriedir)/images
181 cp $(mylibdir)/vg_basic.css $(valkyriedir)/
182 cp $(myimgdir)/*.png $(valkyriedir)/images/
183 $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(valkyriedir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
184
185# html.tar.bz2, .pdf, .ps.bz2 files for downloading from the website
186download-docs:
187 export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
188 /bin/rm -fr $(downloadsdir)
189 mkdir -p $(downloadsdir)
190 @echo ""
191 @echo "Generating valgrind_manual.html.tar.bz2 ..."
192 export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
193 /bin/rm -fr $(vgdir)
194 mkdir -p $(vgdir)
195 mkdir -p $(vgdir)/html
196 mkdir -p $(vgdir)/html/images
197 cp $(mylibdir)/vg_basic.css $(vgdir)/html/
198 cp $(myimgdir)/*.png $(vgdir)/html/images/
199 $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/html/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
200 (cd $(top_builddir)/docs/ && \
201 (tar cfj $(downloadsdir)/valgrind_manual.html.tar.bz2 ./valgrind/html/ ) )
202 /bin/rm -fr $(vgdir)/html/
203 @echo ""
204 @echo "Generating valgrind_manual.pdf ..."
205 mkdir -p $(vgdir)/print
206 mkdir -p $(vgdir)/print/images
207 cp $(myimgdir)/massif-graph-sm.png $(vgdir)/print/images/
208 $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/print/manual.fo $(XSL_FO_STYLE) $(myxmldir)/index.xml
209 (cd $(vgdir)/print/ && \
210 ( pdfxmltex manual.fo && \
211 pdfxmltex manual.fo && \
212 pdfxmltex manual.fo ) &> $(LOGFILE) < /dev/null )
213 @echo ""
214 @echo "Generating valgrind_manual.ps.bz2 ..."
215 (cd $(vgdir)/print/ && \
216 ( pdftops manual.pdf ) )
217 mv $(vgdir)/print/manual.pdf $(downloadsdir)/valgrind_manual.pdf
218 mv $(vgdir)/print/manual.ps $(downloadsdir)/valgrind_manual.ps
219 bzip2 $(downloadsdir)/valgrind_manual.ps
220 /bin/rm -fr $(vgdir)