drd/tests/swapcontext: Improve the portability of this test further
[valgrind.git] / docs / Makefile.am
blobe9d659d2ece5bf192756576b36d70834705398af
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 XML_CATALOG_FILES = /etc/xml/catalog
118 # file to log print output to
119 LOGFILE = print.log
121 # validation stuff
122 XMLLINT       = xmllint
123 XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent
125 # stylesheet processor
126 XSLTPROC       = xsltproc
127 XSLTPROC_FLAGS = --nonet --xinclude
129 # stylesheets
130 XSL_HTML_CHUNK_STYLE  = $(mylibdir)/vg-html-chunk.xsl
131 XSL_FO_STYLE          = $(mylibdir)/vg-fo.xsl
132 XSL_TEXT_STYLE        = $(mylibdir)/vg-faq2txt.xsl
133 XSL_WEBSITE_STYLE     = $(mylibdir)/vg-html-website.xsl
134 XSL_MAN_STYLES = \
135     /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl \
136     /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl \
137     /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl
139 # Input files for valid-manual and valid-manpages
140 MANUAL_XML_FILES = $(myxmldir)/index.xml \
141                      $(myxmldir)/vg-entities.xml \
142                      $(myxmldir)/quick-start-guide.xml \
143                      $(myxmldir)/manual.xml \
144                        $(myxmldir)/manual-intro.xml \
145                        $(myxmldir)/manual-core.xml \
146                        $(myxmldir)/manual-core-adv.xml \
147                      $(top_srcdir)/*/docs/*-manual.xml \
148                      $(myxmldir)/quick-start-guide.xml \
149                      $(myxmldir)/FAQ.xml \
150                      $(myxmldir)/tech-docs.xml \
151                        $(myxmldir)/design-impl.xml \
152                        $(myxmldir)/manual-writing-tools.xml \
153                        $(top_srcdir)/callgrind/docs/cl-format.xml \
154                      $(myxmldir)/dist-docs.xml \
155                        $(top_srcdir)/AUTHORS \
156                        $(top_srcdir)/NEWS \
157                        $(top_srcdir)/NEWS.old \
158                        $(top_srcdir)/README \
159                        $(top_srcdir)/README_MISSING_SYSCALL_OR_IOCTL \
160                        $(top_srcdir)/README_DEVELOPERS \
161                        $(top_srcdir)/README_PACKAGERS \
162                        $(top_srcdir)/README.s390 \
163                        $(top_srcdir)/README.android \
164                        $(top_srcdir)/README.android_emulator \
165                        $(top_srcdir)/README.mips \
166                        $(top_srcdir)/README.solaris \
167                      $(myxmldir)/licenses.xml \
168                        $(top_srcdir)/COPYING \
169                        $(top_srcdir)/COPYING.DOCS
171 MANPAGES_XML_FILES = $(myxmldir)/manpages-index.xml \
172                        $(myxmldir)/valgrind-manpage.xml \
173                          $(myxmldir)/manual-core.xml \
174                        $(top_srcdir)/*/docs/*-manual.xml
176 all-docs: FAQ.txt man-pages html-docs print-docs
178 valid-manual: $(MANUAL_XML_FILES)
179         if type $(XMLLINT) 2>/dev/null; then \
180           $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml && \
181           touch $@; \
182         fi
184 valid-manpages: $(MANPAGES_XML_FILES)
185         if type $(XMLLINT) 2>/dev/null; then \
186           $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/manpages-index.xml && \
187           touch $@; \
188         fi
190 check-local: valid-manual valid-manpages
192 # The text version of the FAQ.
193 FAQ.txt:
194         @echo "Generating the text version of the FAQ ..."
195         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
196         $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./FAQ.txt $(XSL_TEXT_STYLE) $(myxmldir)/FAQ.xml
198 # the valgrind manpages
199 man-pages:
200         set -e; \
201         for x in $(XSL_MAN_STYLES) ; do \
202             if test -f $$x; then \
203                 echo "Using manpage stylesheet: $$x"; \
204                 export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
205                 $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./ $$x $(myxmldir)/manpages-index.xml; \
206                 exit 0; \
207             fi; \
208         done; \
209         echo ""; \
210         echo "Error: I can't find the XSL_MAN_STYLE file";     \
211         echo "Please check where it lives on your system, and"      \
212              "amend the line 'XSL_MAN_STYLES = ' in this Makefile."; \
213         exit 1;
215 # chunked html, on a chapter-by-chapter basis
216 html-docs:
217         @echo "Generating html files..."
218         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
219         mkdir -p $(myhtmldir) && \
220         /bin/rm -fr $(myhtmldir)/ && \
221         mkdir -p $(myhtmldir)/ && \
222         mkdir -p $(myhtmldir)/images && \
223         cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \
224         cp $(myimgdir)/*.png $(myhtmldir)/images && \
225         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
227 # pdf and postscript
228 print-docs:
229         @echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)...";
230         export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
231         mkdir -p $(myprintdir) && \
232         mkdir -p $(myprintdir)/images && \
233         cp $(myimgdir)/*.png $(myprintdir)/images && \
234         xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \
235               -x $(XSL_FO_STYLE) \
236               --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE) && \
237         echo "Generating PS file: $(myprintdir)/index.ps ..." && \
238         pdftops index.pdf && \
239         mv index.pdf index.ps $(myprintdir) && \
240         rm $(LOGFILE)
242 # If the docs have been built, install them.  But don't worry if they have 
243 # not -- developers do 'make install' not from a 'make dist'-ified distro all
244 # the time.
246 # Note: this is done at 'make install' time.
247 # Note 2: the ifeq/else/endif have to be indented one space 
248 # because otherwise it seems that automake thinks it should
249 # be the one to handle the else/endif parts, not GNU make
250 # as we intend.
251 install-data-hook:
252         set -e; \
253         if test -r html ; then \
254                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
255                 cp -r html $(DESTDIR)$(datadir)/doc/valgrind; \
256         fi
257         for f in *.1 ; do \
258                 if test -r $$f ; then \
259                         mkdir -p $(DESTDIR)$(mandir)/man1; \
260                         cp $$f $(DESTDIR)$(mandir)/man1; \
261                 fi \
262         done
263  ifeq ($(BUILD_ALL_DOCS),yes)
264         set -e; \
265         if test -r index.pdf ; then \
266                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
267                 cp index.pdf $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.pdf; \
268         fi
269         set -e; \
270         if test -r index.ps ; then \
271                 mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
272                 cp index.ps $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.ps; \
273         fi
274  endif
276 # This is done at 'make dist' time.  It builds the html docs, print
277 # docs and man pages and copies them into the docs/ directory in the
278 # tarball.
279  ifeq ($(BUILD_ALL_DOCS),yes)
280 dist-hook: FAQ.txt html-docs man-pages print-docs
281         cp -r html $(distdir)
282         cp FAQ.txt $(distdir)/..
283         cp *.1 $(distdir)
284         cp print/index.pdf $(distdir)
285         cp print/index.ps $(distdir)
286  else
287 dist-hook: FAQ.txt html-docs man-pages
288         cp -r html $(distdir)
289         cp FAQ.txt $(distdir)/..
290         cp *.1 $(distdir)
291  endif
293 distclean-local:
294         rm -rf html print
295         rm -f FAQ.txt
296         rm -f $(top_builddir)/FAQ.txt $(top_builddir)/docs/*.1
298 clean-local:
299         rm -f valid-manual valid-manpages
302 # -----------------------------------------------------------------------
303 # Note: the rest of this file is nothing to do with the normal build
304 # tree.  The stuff below contains special targets for web-site
305 # artefacts.
307 # chunked html with no html/body tags, css, or top nav, to fit into the website
308 website-docs:
309         @echo "Generating website html files ..."
310         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
311         /bin/rm -fr $(websitedir)
312         mkdir -p $(websitedir)
313         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(websitedir)/ $(XSL_WEBSITE_STYLE) $(myxmldir)/index.xml
315 # valkyrie carries around her own copy of the valgrind manual
316 valkyrie-docs:
317         @echo "Generating a set of valgrind docs for valkyrie..."
318         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
319         /bin/rm -fr $(valkyriedir)
320         mkdir -p $(valkyriedir)
321         mkdir -p $(valkyriedir)/images
322         cp $(mylibdir)/vg_basic.css $(valkyriedir)/
323         cp $(myimgdir)/*.png $(valkyriedir)/images/
324         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(valkyriedir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
326 # html.tar.bz2, .pdf, .ps.bz2 files for downloading from the website
327 download-docs:
328         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
329         /bin/rm -fr $(downloadsdir)
330         mkdir -p $(downloadsdir)
331         @echo ""
332         @echo "Generating valgrind_manual.html.tar.bz2 ..."
333         export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
334         /bin/rm -fr $(vgdir)
335         mkdir -p $(vgdir)
336         mkdir -p $(vgdir)/html
337         mkdir -p $(vgdir)/html/images
338         cp $(mylibdir)/vg_basic.css $(vgdir)/html/
339         cp $(myimgdir)/*.png $(vgdir)/html/images/
340         $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/html/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
341         (cd $(top_builddir)/docs/ && \
342                 (tar cfj $(downloadsdir)/valgrind_manual.html.tar.bz2 ./valgrind/html/ ) )
343         /bin/rm -fr $(vgdir)/html/
344         @echo ""
345         @echo "Generating valgrind_manual.pdf ..."
346         mkdir -p $(vgdir)/print
347         mkdir -p $(vgdir)/print/images
348         cp $(myimgdir)/*.png $(vgdir)/print/images/
349         xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \
350               -x $(XSL_FO_STYLE) \
351               --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE)
352         mv index.pdf $(vgdir)/print/manual.pdf
353         @echo ""
354         @echo "Generating valgrind_manual.ps.bz2 ..."
355         (cd $(vgdir)/print/ && \
356                 ( pdftops manual.pdf ) )
357         mv $(vgdir)/print/manual.pdf $(downloadsdir)/valgrind_manual.pdf
358         mv $(vgdir)/print/manual.ps $(downloadsdir)/valgrind_manual.ps
359         bzip2 $(downloadsdir)/valgrind_manual.ps
360         /bin/rm -fr $(vgdir) $(LOGFILE)