drd-manual.xml: Fix link to libstdc++ manual GLIBCXX_FORCE_NEW reference.
[valgrind.git] / docs / Makefile.am
blob5c777a263a342b7551149f6d1b81510954d789f6
2 ##-------------------------------------------------------------
3 ## HACK: stuff to avoid making the print docs if installing the
4 ## tools to do so is impractical / too difficult
5 ##-------------------------------------------------------------
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 need to re-run autogen.sh and configure to make it take effect.
10 BUILD_ALL_DOCS=yes
12 # Whether to run xmlto pdf --with-fop
13 # This is de fault, set to empty to use the default fo to pdf
14 # processor that xmlto uses (which might be pdfxmltex, which is
15 # known to be broken).
16 WITH_FOP=--with-fop
18 ##-------------------------------------------------------------
19 ## END OF HACK
20 ##-------------------------------------------------------------
22 EXTRA_DIST = \
23         README \
24         images/home.png \
25         images/next.png \
26         images/prev.png \
27         images/up.png \
28         images/kcachegrind_xtree.png \
29         images/dh-tree.png \
30         internals/3_0_BUGSTATUS.txt \
31         internals/3_1_BUGSTATUS.txt \
32         internals/3_2_BUGSTATUS.txt \
33         internals/3_3_BUGSTATUS.txt \
34         internals/3_4_BUGSTATUS.txt \
35         internals/3_5_BUGSTATUS.txt \
36         internals/3_7_BUGSTATUS.txt \
37         internals/3_8_BUGSTATUS.txt \
38         internals/3_9_BUGSTATUS.txt \
39         internals/3_10_BUGSTATUS.txt \
40         internals/3_11_BUGSTATUS.txt \
41         internals/3_12_BUGSTATUS.txt \
42         internals/3_13_BUGSTATUS.txt \
43         internals/3_14_BUGSTATUS.txt \
44         internals/3_15_BUGSTATUS.txt \
45         internals/MERGE_3_10_1.txt \
46         internals/arm_thumb_notes_gdbserver.txt \
47         internals/avx-notes.txt \
48         internals/BIG_APP_NOTES.txt \
49         internals/Darwin-notes.txt \
50         internals/SPEC-notes.txt \
51         internals/directory-structure.txt \
52         internals/howto_BUILD_KDE42.txt \
53         internals/howto_oprofile.txt \
54         internals/m_replacemalloc.txt \
55         internals/m_syswrap.txt \
56         internals/module-structure.txt \
57         internals/multiple-architectures.txt \
58         internals/notes.txt \
59         internals/performance.txt \
60         internals/porting-HOWTO.txt \
61         internals/mpi2entries.txt \
62         internals/porting-to-ARM.txt \
63         internals/qemu-aarch64-linux-HOWTO.txt \
64         internals/qemu-mips64-linux-HOWTO.txt \
65         internals/register-uses.txt \
66         internals/release-HOWTO.txt \
67         internals/segments-seginfos.txt \
68         internals/t-chaining-notes.txt \
69         internals/threads-syscalls-signals.txt \
70         internals/tm-mutexstates.dot \
71         internals/tm-threadstates.dot \
72         internals/tracking-fn-entry-exit.txt \
73         internals/why-no-libc.txt \
74         internals/xml-output.txt \
75         internals/xml-output-protocol4.txt \
76         lib/line-wrap.xsl \
77         lib/vg_basic.css \
78         lib/vg-fo.xsl \
79         lib/vg-faq2txt.xsl \
80         lib/vg-html-chunk.xsl \
81         lib/vg-html-website.xsl \
82         lib/vg-html-common.xsl \
83         xml/FAQ.xml \
84         xml/dist-docs.xml \
85         xml/index.xml \
86         xml/licenses.xml \
87         xml/manpages-index.xml \
88         xml/manual.xml \
89         xml/manual-intro.xml \
90         xml/manual-core.xml \
91         xml/manual-core-adv.xml \
92         xml/manual-writing-tools.xml \
93         xml/design-impl.xml \
94         xml/quick-start-guide.xml \
95         xml/tech-docs.xml \
96         xml/valgrind-manpage.xml \
97         xml/vg-entities.xml \
98         xml/xml_help.txt
101 ##-------------------------------------------------------------------
102 ## Below here is more ordinary make stuff...
103 ##-------------------------------------------------------------------
104 myxmldir   = $(top_srcdir)/docs/xml
105 myimgdir   = $(top_srcdir)/docs/images
106 mylibdir   = $(top_srcdir)/docs/lib
108 myhtmldir  = $(top_builddir)/docs/html
109 myprintdir = $(top_builddir)/docs/print
111 websitedir   = $(top_builddir)/docs/website
112 valkyriedir  = $(top_builddir)/docs/vg-html
113 downloadsdir = $(top_builddir)/docs/downloads
114 vgdir        = $(top_builddir)/docs/valgrind
116 if VGCONF_OS_IS_FREEBSD
117 XML_CATALOG_FILES = /usr/local/share/xml/catalog
118 else
119 XML_CATALOG_FILES = /etc/xml/catalog
120 endif
122 # file to log print output to
123 LOGFILE = print.log
125 # validation stuff
126 XMLLINT       = xmllint
127 XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent
129 # stylesheet processor
130 XSLTPROC       = xsltproc
131 XSLTPROC_FLAGS = --nonet --xinclude
133 # stylesheets
134 XSL_HTML_CHUNK_STYLE  = $(mylibdir)/vg-html-chunk.xsl
135 XSL_FO_STYLE          = $(mylibdir)/vg-fo.xsl
136 XSL_TEXT_STYLE        = $(mylibdir)/vg-faq2txt.xsl
137 XSL_WEBSITE_STYLE     = $(mylibdir)/vg-html-website.xsl
138 XSL_MAN_STYLES = \
139     /usr/local/share/xsl/docbook/manpages/docbook.xsl \
140     /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl \
141     /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl \
142     /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl
144 # Input files for valid-manual and valid-manpages
145 MANUAL_XML_FILES = $(myxmldir)/index.xml \
146                      $(myxmldir)/vg-entities.xml \
147                      $(myxmldir)/quick-start-guide.xml \
148                      $(myxmldir)/manual.xml \
149                        $(myxmldir)/manual-intro.xml \
150                        $(myxmldir)/manual-core.xml \
151                        $(myxmldir)/manual-core-adv.xml \
152                      $(top_srcdir)/*/docs/*-manual.xml \
153                      $(myxmldir)/quick-start-guide.xml \
154                      $(myxmldir)/FAQ.xml \
155                      $(myxmldir)/tech-docs.xml \
156                        $(myxmldir)/design-impl.xml \
157                        $(myxmldir)/manual-writing-tools.xml \
158                        $(top_srcdir)/callgrind/docs/cl-format.xml \
159                      $(myxmldir)/dist-docs.xml \
160                        $(top_srcdir)/AUTHORS \
161                        $(top_srcdir)/NEWS \
162                        $(top_srcdir)/NEWS.old \
163                        $(top_srcdir)/README \
164                        $(top_srcdir)/README_MISSING_SYSCALL_OR_IOCTL \
165                        $(top_srcdir)/README_DEVELOPERS \
166                        $(top_srcdir)/README_PACKAGERS \
167                        $(top_srcdir)/README.s390 \
168                        $(top_srcdir)/README.android \
169                        $(top_srcdir)/README.android_emulator \
170                        $(top_srcdir)/README.mips \
171                        $(top_srcdir)/README.solaris \
172                      $(myxmldir)/licenses.xml \
173                        $(top_srcdir)/COPYING \
174                        $(top_srcdir)/COPYING.DOCS
176 MANPAGES_XML_FILES = $(myxmldir)/manpages-index.xml \
177                        $(myxmldir)/valgrind-manpage.xml \
178                          $(myxmldir)/manual-core.xml \
179                        $(top_srcdir)/*/docs/*-manual.xml
181 all-docs: FAQ.txt man-pages html-docs print-docs
183 valid-manual: $(MANUAL_XML_FILES)
184         if type $(XMLLINT) 2>/dev/null; then \
185           $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml && \
186           touch $@; \
187         fi
189 valid-manpages: $(MANPAGES_XML_FILES)
190         if type $(XMLLINT) 2>/dev/null; then \
191           $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/manpages-index.xml && \
192           touch $@; \
193         fi
195 check-local: valid-manual valid-manpages
197 # The text version of the FAQ.
198 FAQ.txt:
199         @echo "Generating the text version of the FAQ ..."
200         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
201         $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./FAQ.txt $(XSL_TEXT_STYLE) $(myxmldir)/FAQ.xml
203 # the valgrind manpages
204 man-pages:
205         set -e; \
206         for x in $(XSL_MAN_STYLES) ; do \
207             if test -f $$x; then \
208                 echo "Using manpage stylesheet: $$x"; \
209                 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
210                 $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./ $$x $(myxmldir)/manpages-index.xml; \
211                 exit 0; \
212             fi; \
213         done; \
214         echo ""; \
215         echo "Error: I can't find the XSL_MAN_STYLE file";     \
216         echo "Please check where it lives on your system, and"      \
217              "amend the line 'XSL_MAN_STYLES = ' in this Makefile."; \
218         exit 1;
220 # chunked html, on a chapter-by-chapter basis
221 html-docs:
222         @echo "Generating html files..."
223         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
224         mkdir -p $(myhtmldir) && \
225         /bin/rm -fr $(myhtmldir)/ && \
226         mkdir -p $(myhtmldir)/ && \
227         mkdir -p $(myhtmldir)/images && \
228         cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \
229         cp $(myimgdir)/*.png $(myhtmldir)/images && \
230         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
232 # pdf and postscript
233 print-docs:
234         @echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)...";
235         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
236         mkdir -p $(myprintdir) && \
237         mkdir -p $(myprintdir)/images && \
238         cp $(myimgdir)/*.png $(myprintdir)/images && \
239         xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \
240               -x $(XSL_FO_STYLE) \
241               --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE) && \
242         echo "Generating PS file: $(myprintdir)/index.ps ..." && \
243         pdftops index.pdf && \
244         mv index.pdf index.ps $(myprintdir) && \
245         rm $(LOGFILE)
247 # If the docs have been built, install them.  But don't worry if they have 
248 # not -- developers do 'make install' not from a 'make dist'-ified distro all
249 # the time.
251 # Note: this is done at 'make install' time.
252 # Note 2: the ifeq/else/endif have to be indented one space 
253 # because otherwise it seems that automake thinks it should
254 # be the one to handle the else/endif parts, not GNU make
255 # as we intend.
256 install-data-hook:
257         set -e; \
258         if test -r html ; then \
259                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
260                 cp -r html $(DESTDIR)$(datadir)/doc/valgrind; \
261         fi
262         for f in *.1 ; do \
263                 if test -r $$f ; then \
264                         mkdir -p $(DESTDIR)$(mandir)/man1; \
265                         cp $$f $(DESTDIR)$(mandir)/man1; \
266                 fi \
267         done
268  ifeq ($(BUILD_ALL_DOCS),yes)
269         set -e; \
270         if test -r index.pdf ; then \
271                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
272                 cp index.pdf $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.pdf; \
273         fi
274         set -e; \
275         if test -r index.ps ; then \
276                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
277                 cp index.ps $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.ps; \
278         fi
279  endif
281 # This is done at 'make dist' time.  It builds the html docs, print
282 # docs and man pages and copies them into the docs/ directory in the
283 # tarball.
284  ifeq ($(BUILD_ALL_DOCS),yes)
285 dist-hook: FAQ.txt html-docs man-pages print-docs
286         cp -r html $(distdir)
287         cp FAQ.txt $(distdir)/..
288         cp *.1 $(distdir)
289         cp print/index.pdf $(distdir)
290         cp print/index.ps $(distdir)
291  else
292 dist-hook: FAQ.txt html-docs man-pages
293         cp -r html $(distdir)
294         cp FAQ.txt $(distdir)/..
295         cp *.1 $(distdir)
296  endif
298 distclean-local:
299         rm -rf html print
300         rm -f FAQ.txt
301         rm -f $(top_builddir)/FAQ.txt $(top_builddir)/docs/*.1
303 clean-local:
304         rm -f valid-manual valid-manpages
307 # -----------------------------------------------------------------------
308 # Note: the rest of this file is nothing to do with the normal build
309 # tree.  The stuff below contains special targets for web-site
310 # artefacts.
312 # chunked html with no html/body tags, css, or top nav, to fit into the website
313 website-docs:
314         @echo "Generating website html files ..."
315         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
316         /bin/rm -fr $(websitedir)
317         mkdir -p $(websitedir)
318         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(websitedir)/ $(XSL_WEBSITE_STYLE) $(myxmldir)/index.xml
320 # valkyrie carries around her own copy of the valgrind manual
321 valkyrie-docs:
322         @echo "Generating a set of valgrind docs for valkyrie..."
323         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
324         /bin/rm -fr $(valkyriedir)
325         mkdir -p $(valkyriedir)
326         mkdir -p $(valkyriedir)/images
327         cp $(mylibdir)/vg_basic.css $(valkyriedir)/
328         cp $(myimgdir)/*.png $(valkyriedir)/images/
329         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(valkyriedir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
331 # html.tar.bz2, .pdf, .ps.bz2 files for downloading from the website
332 download-docs:
333         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
334         /bin/rm -fr $(downloadsdir)
335         mkdir -p $(downloadsdir)
336         @echo ""
337         @echo "Generating valgrind_manual.html.tar.bz2 ..."
338         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
339         /bin/rm -fr $(vgdir)
340         mkdir -p $(vgdir)
341         mkdir -p $(vgdir)/html
342         mkdir -p $(vgdir)/html/images
343         cp $(mylibdir)/vg_basic.css $(vgdir)/html/
344         cp $(myimgdir)/*.png $(vgdir)/html/images/
345         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/html/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
346         (cd $(top_builddir)/docs/ && \
347                 (tar cfj $(downloadsdir)/valgrind_manual.html.tar.bz2 ./valgrind/html/ ) )
348         /bin/rm -fr $(vgdir)/html/
349         @echo ""
350         @echo "Generating valgrind_manual.pdf ..."
351         mkdir -p $(vgdir)/print
352         mkdir -p $(vgdir)/print/images
353         cp $(myimgdir)/*.png $(vgdir)/print/images/
354         xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \
355               -x $(XSL_FO_STYLE) \
356               --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE)
357         mv index.pdf $(vgdir)/print/manual.pdf
358         @echo ""
359         @echo "Generating valgrind_manual.ps.bz2 ..."
360         (cd $(vgdir)/print/ && \
361                 ( pdftops manual.pdf ) )
362         mv $(vgdir)/print/manual.pdf $(downloadsdir)/valgrind_manual.pdf
363         mv $(vgdir)/print/manual.ps $(downloadsdir)/valgrind_manual.ps
364         bzip2 $(downloadsdir)/valgrind_manual.ps
365         /bin/rm -fr $(vgdir) $(LOGFILE)