non-linux regtest: update cmdline expecteds
[valgrind.git] / docs / Makefile.am
blobf9ba4e395817fde26f4662af44bec2d589c34e8f
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-debug.txt \
50         internals/Darwin-notes.txt \
51         internals/SPEC-notes.txt \
52         internals/directory-structure.txt \
53         internals/howto_BUILD_KDE42.txt \
54         internals/howto_oprofile.txt \
55         internals/m_replacemalloc.txt \
56         internals/m_syswrap.txt \
57         internals/module-structure.txt \
58         internals/multiple-architectures.txt \
59         internals/notes.txt \
60         internals/performance.txt \
61         internals/porting-HOWTO.txt \
62         internals/mpi2entries.txt \
63         internals/porting-to-ARM.txt \
64         internals/qemu-aarch64-linux-HOWTO.txt \
65         internals/qemu-mips64-linux-HOWTO.txt \
66         internals/register-uses.txt \
67         internals/release-HOWTO.txt \
68         internals/segments-seginfos.txt \
69         internals/t-chaining-notes.txt \
70         internals/threads-syscalls-signals.txt \
71         internals/tm-mutexstates.dot \
72         internals/tm-threadstates.dot \
73         internals/tracking-fn-entry-exit.txt \
74         internals/why-no-libc.txt \
75         internals/xml-output.txt \
76         internals/xml-output-protocol4.txt \
77         lib/line-wrap.xsl \
78         lib/vg_basic.css \
79         lib/vg-fo.xsl \
80         lib/vg-faq2txt.xsl \
81         lib/vg-html-chunk.xsl \
82         lib/vg-html-website.xsl \
83         lib/vg-html-common.xsl \
84         xml/FAQ.xml \
85         xml/dist-docs.xml \
86         xml/index.xml \
87         xml/licenses.xml \
88         xml/manpages-index.xml \
89         xml/manual.xml \
90         xml/manual-intro.xml \
91         xml/manual-core.xml \
92         xml/manual-core-adv.xml \
93         xml/manual-writing-tools.xml \
94         xml/design-impl.xml \
95         xml/quick-start-guide.xml \
96         xml/tech-docs.xml \
97         xml/valgrind-manpage.xml \
98         xml/vg-entities.xml \
99         xml/xml_help.txt
102 ##-------------------------------------------------------------------
103 ## Below here is more ordinary make stuff...
104 ##-------------------------------------------------------------------
105 myxmldir   = $(top_srcdir)/docs/xml
106 myimgdir   = $(top_srcdir)/docs/images
107 mylibdir   = $(top_srcdir)/docs/lib
109 myhtmldir  = $(top_builddir)/docs/html
110 myprintdir = $(top_builddir)/docs/print
112 websitedir   = $(top_builddir)/docs/website
113 valkyriedir  = $(top_builddir)/docs/vg-html
114 downloadsdir = $(top_builddir)/docs/downloads
115 vgdir        = $(top_builddir)/docs/valgrind
117 if VGCONF_OS_IS_FREEBSD
118 XML_CATALOG_FILES = /usr/local/share/xml/catalog
119 else
120 XML_CATALOG_FILES = /etc/xml/catalog
121 endif
123 # file to log print output to
124 LOGFILE = print.log
126 # validation stuff
127 XMLLINT       = xmllint
128 XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent \
129                 --path $(top_builddir)/docs/xml
131 # stylesheet processor
132 XSLTPROC       = xsltproc
133 XSLTPROC_FLAGS = --nonet --xinclude --path $(top_builddir)/docs/xml
135 # stylesheets
136 XSL_HTML_CHUNK_STYLE  = $(mylibdir)/vg-html-chunk.xsl
137 XSL_FO_STYLE          = $(mylibdir)/vg-fo.xsl
138 XSL_TEXT_STYLE        = $(mylibdir)/vg-faq2txt.xsl
139 XSL_WEBSITE_STYLE     = $(mylibdir)/vg-html-website.xsl
140 XSL_MAN_STYLES = \
141     /usr/local/share/xsl/docbook/manpages/docbook.xsl \
142     /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl \
143     /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl \
144     /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl
146 # Input files for valid-manual and valid-manpages
147 MANUAL_XML_FILES = $(myxmldir)/index.xml \
148                      $(top_builddir)/docs/xml/vg-entities.xml \
149                      $(myxmldir)/quick-start-guide.xml \
150                      $(myxmldir)/manual.xml \
151                        $(myxmldir)/manual-intro.xml \
152                        $(myxmldir)/manual-core.xml \
153                        $(myxmldir)/manual-core-adv.xml \
154                      $(top_srcdir)/*/docs/*-manual.xml \
155                      $(myxmldir)/quick-start-guide.xml \
156                      $(myxmldir)/FAQ.xml \
157                      $(myxmldir)/tech-docs.xml \
158                        $(myxmldir)/design-impl.xml \
159                        $(myxmldir)/manual-writing-tools.xml \
160                        $(top_srcdir)/callgrind/docs/cl-format.xml \
161                      $(myxmldir)/dist-docs.xml \
162                        $(top_srcdir)/AUTHORS \
163                        $(top_srcdir)/NEWS \
164                        $(top_srcdir)/NEWS.old \
165                        $(top_srcdir)/README \
166                        $(top_srcdir)/README_MISSING_SYSCALL_OR_IOCTL \
167                        $(top_srcdir)/README_DEVELOPERS \
168                        $(top_srcdir)/README_PACKAGERS \
169                        $(top_srcdir)/README.s390 \
170                        $(top_srcdir)/README.android \
171                        $(top_srcdir)/README.android_emulator \
172                        $(top_srcdir)/README.mips \
173                        $(top_srcdir)/README.solaris \
174                      $(myxmldir)/licenses.xml \
175                        $(top_srcdir)/COPYING \
176                        $(top_srcdir)/COPYING.DOCS
178 MANPAGES_XML_FILES = $(myxmldir)/manpages-index.xml \
179                        $(myxmldir)/valgrind-manpage.xml \
180                          $(myxmldir)/manual-core.xml \
181                        $(top_srcdir)/*/docs/*-manual.xml
183 all-docs: FAQ.txt man-pages html-docs print-docs
185 valid-manual: $(MANUAL_XML_FILES)
186         if type $(XMLLINT) 2>/dev/null; then \
187           $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml && \
188           touch $@; \
189         fi
191 valid-manpages: $(MANPAGES_XML_FILES)
192         if type $(XMLLINT) 2>/dev/null; then \
193           $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/manpages-index.xml && \
194           touch $@; \
195         fi
197 check-local: valid-manual valid-manpages
199 # The text version of the FAQ.
200 FAQ.txt:
201         @echo "Generating the text version of the FAQ ..."
202         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
203         $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./FAQ.txt $(XSL_TEXT_STYLE) $(myxmldir)/FAQ.xml
205 # the valgrind manpages
206 man-pages:
207         set -e; \
208         for x in $(XSL_MAN_STYLES) ; do \
209             if test -f $$x; then \
210                 echo "Using manpage stylesheet: $$x"; \
211                 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
212                 $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./ $$x $(myxmldir)/manpages-index.xml; \
213                 exit 0; \
214             fi; \
215         done; \
216         echo ""; \
217         echo "Error: I can't find the XSL_MAN_STYLE file";     \
218         echo "Please check where it lives on your system, and"      \
219              "amend the line 'XSL_MAN_STYLES = ' in this Makefile."; \
220         exit 1;
222 # chunked html, on a chapter-by-chapter basis
223 html-docs:
224         @echo "Generating html files..."
225         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
226         mkdir -p $(myhtmldir) && \
227         /bin/rm -fr $(myhtmldir)/ && \
228         mkdir -p $(myhtmldir)/ && \
229         mkdir -p $(myhtmldir)/images && \
230         cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \
231         cp $(myimgdir)/*.png $(myhtmldir)/images && \
232         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
234 # pdf and postscript
235 print-docs:
236         @echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)...";
237         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
238         mkdir -p $(myprintdir) && \
239         mkdir -p $(myprintdir)/images && \
240         cp $(myimgdir)/*.png $(myprintdir)/images && \
241         xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \
242               -x $(XSL_FO_STYLE) \
243               --searchpath $(top_builddir)/docs/xml:print \
244               pdf $(myxmldir)/index.xml &> $(LOGFILE) && \
245         echo "Generating PS file: $(myprintdir)/index.ps ..." && \
246         pdftops index.pdf && \
247         mv index.pdf index.ps $(myprintdir) && \
248         rm $(LOGFILE)
250 # If the docs have been built, install them.  But don't worry if they have 
251 # not -- developers do 'make install' not from a 'make dist'-ified distro all
252 # the time.
254 # Note: this is done at 'make install' time.
255 # Note 2: the ifeq/else/endif have to be indented one space 
256 # because otherwise it seems that automake thinks it should
257 # be the one to handle the else/endif parts, not GNU make
258 # as we intend.
259 install-data-hook:
260         set -e; \
261         if test -r html ; then \
262                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
263                 cp -r html $(DESTDIR)$(datadir)/doc/valgrind; \
264         fi
265         for f in *.1 ; do \
266                 if test -r $$f ; then \
267                         mkdir -p $(DESTDIR)$(mandir)/man1; \
268                         cp $$f $(DESTDIR)$(mandir)/man1; \
269                 fi \
270         done
271  ifeq ($(BUILD_ALL_DOCS),yes)
272         set -e; \
273         if test -r index.pdf ; then \
274                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
275                 cp index.pdf $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.pdf; \
276         fi
277         set -e; \
278         if test -r index.ps ; then \
279                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
280                 cp index.ps $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.ps; \
281         fi
282  endif
284 # This is done at 'make dist' time.  It builds the html docs, print
285 # docs and man pages and copies them into the docs/ directory in the
286 # tarball.
287  ifeq ($(BUILD_ALL_DOCS),yes)
288 dist-hook: FAQ.txt html-docs man-pages print-docs
289         cp -r html $(distdir)
290         cp FAQ.txt $(distdir)/..
291         cp *.1 $(distdir)
292         cp print/index.pdf $(distdir)
293         cp print/index.ps $(distdir)
294  else
295 dist-hook: FAQ.txt html-docs man-pages
296         cp -r html $(distdir)
297         cp FAQ.txt $(distdir)/..
298         cp *.1 $(distdir)
299  endif
301 distclean-local:
302         rm -rf html print
303         rm -f FAQ.txt
304         rm -f $(top_builddir)/FAQ.txt $(top_builddir)/docs/*.1
306 clean-local:
307         rm -f valid-manual valid-manpages
310 # -----------------------------------------------------------------------
311 # Note: the rest of this file is nothing to do with the normal build
312 # tree.  The stuff below contains special targets for web-site
313 # artefacts.
315 # chunked html with no html/body tags, css, or top nav, to fit into the website
316 website-docs:
317         @echo "Generating website html files ..."
318         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
319         /bin/rm -fr $(websitedir)
320         mkdir -p $(websitedir)
321         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(websitedir)/ $(XSL_WEBSITE_STYLE) $(myxmldir)/index.xml
323 # valkyrie carries around her own copy of the valgrind manual
324 valkyrie-docs:
325         @echo "Generating a set of valgrind docs for valkyrie..."
326         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
327         /bin/rm -fr $(valkyriedir)
328         mkdir -p $(valkyriedir)
329         mkdir -p $(valkyriedir)/images
330         cp $(mylibdir)/vg_basic.css $(valkyriedir)/
331         cp $(myimgdir)/*.png $(valkyriedir)/images/
332         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(valkyriedir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
334 # html.tar.bz2, .pdf, .ps.bz2 files for downloading from the website
335 download-docs:
336         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
337         /bin/rm -fr $(downloadsdir)
338         mkdir -p $(downloadsdir)
339         @echo ""
340         @echo "Generating valgrind_manual.html.tar.bz2 ..."
341         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
342         /bin/rm -fr $(vgdir)
343         mkdir -p $(vgdir)
344         mkdir -p $(vgdir)/html
345         mkdir -p $(vgdir)/html/images
346         cp $(mylibdir)/vg_basic.css $(vgdir)/html/
347         cp $(myimgdir)/*.png $(vgdir)/html/images/
348         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/html/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
349         (cd $(top_builddir)/docs/ && \
350                 (tar cfj $(downloadsdir)/valgrind_manual.html.tar.bz2 ./valgrind/html/ ) )
351         /bin/rm -fr $(vgdir)/html/
352         @echo ""
353         @echo "Generating valgrind_manual.pdf ..."
354         mkdir -p $(vgdir)/print
355         mkdir -p $(vgdir)/print/images
356         cp $(myimgdir)/*.png $(vgdir)/print/images/
357         xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \
358               -x $(XSL_FO_STYLE) \
359               --searchpath $(top_builddir)/docs/xml:print \
360               pdf $(myxmldir)/index.xml &> $(LOGFILE)
361         mv index.pdf $(vgdir)/print/manual.pdf
362         @echo ""
363         @echo "Generating valgrind_manual.ps.bz2 ..."
364         (cd $(vgdir)/print/ && \
365                 ( pdftops manual.pdf ) )
366         mv $(vgdir)/print/manual.pdf $(downloadsdir)/valgrind_manual.pdf
367         mv $(vgdir)/print/manual.ps $(downloadsdir)/valgrind_manual.ps
368         bzip2 $(downloadsdir)/valgrind_manual.ps
369         /bin/rm -fr $(vgdir) $(LOGFILE)