• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
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 need to re-run autogen.sh and configure to make it take effect.
10BUILD_ALL_DOCS=yes
11
12##-------------------------------------------------------------
13## END OF HACK
14##-------------------------------------------------------------
15
16EXTRA_DIST = \
17	README \
18	images/home.png \
19	images/next.png \
20	images/prev.png \
21	images/up.png \
22	internals/3_0_BUGSTATUS.txt \
23	internals/3_1_BUGSTATUS.txt \
24	internals/3_2_BUGSTATUS.txt \
25	internals/3_3_BUGSTATUS.txt \
26	internals/3_4_BUGSTATUS.txt \
27	internals/3_5_BUGSTATUS.txt \
28	internals/3_7_BUGSTATUS.txt \
29	internals/3_8_BUGSTATUS.txt \
30	internals/3_9_BUGSTATUS.txt \
31	internals/arm_thumb_notes_gdbserver.txt \
32	internals/avx-notes.txt \
33	internals/BIG_APP_NOTES.txt \
34	internals/Darwin-notes.txt \
35	internals/SPEC-notes.txt \
36	internals/directory-structure.txt \
37	internals/howto_BUILD_KDE42.txt \
38	internals/howto_oprofile.txt \
39	internals/m_replacemalloc.txt \
40	internals/m_syswrap.txt \
41	internals/module-structure.txt \
42	internals/multiple-architectures.txt \
43	internals/notes.txt \
44	internals/performance.txt \
45	internals/porting-HOWTO.txt \
46	internals/mpi2entries.txt \
47	internals/porting-to-ARM.txt \
48	internals/register-uses.txt \
49	internals/release-HOWTO.txt \
50	internals/segments-seginfos.txt \
51	internals/t-chaining-notes.txt \
52	internals/threads-syscalls-signals.txt \
53	internals/tm-mutexstates.dot \
54	internals/tm-threadstates.dot \
55	internals/tracking-fn-entry-exit.txt \
56	internals/why-no-libc.txt \
57	internals/xml-output.txt \
58	internals/xml-output-protocol4.txt \
59	lib/line-wrap.xsl \
60	lib/vg_basic.css \
61	lib/vg-fo.xsl \
62	lib/vg-faq2txt.xsl \
63	lib/vg-html-chunk.xsl \
64	lib/vg-html-website.xsl \
65	lib/vg-html-common.xsl \
66	xml/FAQ.xml \
67	xml/dist-docs.xml \
68	xml/index.xml \
69	xml/licenses.xml \
70	xml/manpages-index.xml \
71	xml/manual.xml \
72	xml/manual-intro.xml \
73	xml/manual-core.xml \
74	xml/manual-core-adv.xml \
75	xml/manual-writing-tools.xml \
76	xml/design-impl.xml \
77	xml/quick-start-guide.xml \
78	xml/tech-docs.xml \
79	xml/valgrind-manpage.xml \
80	xml/vg-entities.xml \
81	xml/xml_help.txt
82
83
84##-------------------------------------------------------------------
85## Below here is more ordinary make stuff...
86##-------------------------------------------------------------------
87myxmldir   = $(top_srcdir)/docs/xml
88myimgdir   = $(top_srcdir)/docs/images
89mylibdir   = $(top_srcdir)/docs/lib
90
91myhtmldir  = $(top_builddir)/docs/html
92myprintdir = $(top_builddir)/docs/print
93
94websitedir   = $(top_builddir)/docs/website
95valkyriedir  = $(top_builddir)/docs/vg-html
96downloadsdir = $(top_builddir)/docs/downloads
97vgdir        = $(top_builddir)/docs/valgrind
98
99XML_CATALOG_FILES = /etc/xml/catalog
100
101# file to log print output to
102LOGFILE = print.log
103
104# validation stuff
105XMLLINT       = xmllint
106LINT_FLAGS    = --noblanks --noout --xinclude --postvalid --noent
107# validate with docbook 4.3 'cos it supports xml:base natively
108VALID_FLAGS   = --dtdvalid http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
109XMLLINT_FLAGS = $(LINT_FLAGS) $(VALID_FLAGS)
110
111# stylesheet processor
112XSLTPROC       = xsltproc
113XSLTPROC_FLAGS = --nonet --xinclude
114
115# stylesheets
116XSL_HTML_CHUNK_STYLE  = $(mylibdir)/vg-html-chunk.xsl
117XSL_FO_STYLE          = $(mylibdir)/vg-fo.xsl
118XSL_TEXT_STYLE        = $(mylibdir)/vg-faq2txt.xsl
119XSL_WEBSITE_STYLE     = $(mylibdir)/vg-html-website.xsl
120XSL_MAN_STYLES = \
121    /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl \
122    /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl \
123    /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl
124
125all-docs: FAQ.txt man-pages html-docs print-docs
126
127valid:
128	$(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml
129
130# The text version of the FAQ.
131FAQ.txt:
132	@echo "Generating the text version of the FAQ ..."
133	export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
134	$(XSLTPROC) $(XSLTPROC_FLAGS) -o ./FAQ.txt $(XSL_TEXT_STYLE) $(myxmldir)/FAQ.xml
135
136# the valgrind manpages
137man-pages:
138	set -e; \
139	for x in $(XSL_MAN_STYLES) ; do \
140	    if test -f $$x; then \
141		echo "Using manpage stylesheet: $$x"; \
142		export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
143		$(XSLTPROC) $(XSLTPROC_FLAGS) -o ./ $$x $(myxmldir)/manpages-index.xml; \
144		exit 0; \
145	    fi; \
146	done; \
147	echo ""; \
148	echo "Error: I can't find the XSL_MAN_STYLE file";     \
149	echo "Please check where it lives on your system, and"      \
150	     "amend the line 'XSL_MAN_STYLES = ' in this Makefile."; \
151	exit 1;
152
153# chunked html, on a chapter-by-chapter basis
154html-docs:
155	@echo "Generating html files..."
156	export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
157	mkdir -p $(myhtmldir) && \
158	/bin/rm -fr $(myhtmldir)/ && \
159	mkdir -p $(myhtmldir)/ && \
160	mkdir -p $(myhtmldir)/images && \
161	cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \
162	cp $(myimgdir)/*.png $(myhtmldir)/images && \
163	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
164
165# pdf and postscript
166print-docs:
167	@echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)...";
168	export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \
169	mkdir -p $(myprintdir) && \
170	mkdir -p $(myprintdir)/images && \
171	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myprintdir)/index.fo $(XSL_FO_STYLE) $(myxmldir)/index.xml && \
172	(cd $(myprintdir) && \
173         ( pdfxmltex index.fo && \
174	   pdfxmltex index.fo && \
175	   pdfxmltex index.fo ) &> $(LOGFILE) < /dev/null && \
176	 echo "Generating PS file: $(myprintdir)/index.ps ..." && \
177	 pdftops index.pdf && \
178	 rm -f *.log *.aux *.fo *.out)
179
180# If the docs have been built, install them.  But don't worry if they have
181# not -- developers do 'make install' not from a 'make dist'-ified distro all
182# the time.
183#
184# Note: this is done at 'make install' time.
185# Note 2: the ifeq/else/endif have to be indented one space
186# because otherwise it seems that automake thinks it should
187# be the one to handle the else/endif parts, not GNU make
188# as we intend.
189install-data-hook:
190	set -e; \
191	if test -r html ; then \
192		mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
193		cp -r html $(DESTDIR)$(datadir)/doc/valgrind; \
194	fi
195	for f in *.1 ; do \
196		if test -r $$f ; then \
197			mkdir -p $(DESTDIR)$(mandir)/man1; \
198			cp $$f $(DESTDIR)$(mandir)/man1; \
199		fi \
200	done
201 ifeq ($(BUILD_ALL_DOCS),yes)
202	set -e; \
203	if test -r index.pdf ; then \
204		mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
205		cp index.pdf $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.pdf; \
206	fi
207	set -e; \
208	if test -r index.ps ; then \
209		mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
210		cp index.ps $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.ps; \
211	fi
212 endif
213
214# This is done at 'make dist' time.  It builds the html docs, print
215# docs and man pages and copies them into the docs/ directory in the
216# tarball.
217 ifeq ($(BUILD_ALL_DOCS),yes)
218dist-hook: FAQ.txt html-docs man-pages print-docs
219	cp -r html $(distdir)
220	cp FAQ.txt $(distdir)/..
221	cp *.1 $(distdir)
222	cp print/index.pdf $(distdir)
223	cp print/index.ps $(distdir)
224 else
225dist-hook: FAQ.txt html-docs man-pages
226	cp -r html $(distdir)
227	cp FAQ.txt $(distdir)/..
228	cp *.1 $(distdir)
229 endif
230
231distclean-local:
232	rm -rf html print
233	rm -f FAQ.txt
234	rm -f $(top_builddir)/FAQ.txt $(top_builddir)/docs/*.1
235
236
237
238# -----------------------------------------------------------------------
239# Note: the rest of this file is nothing to do with the normal build
240# tree.  The stuff below contains special targets for web-site
241# artefacts.
242
243# chunked html with no html/body tags, css, or top nav, to fit into the website
244website-docs:
245	@echo "Generating website html files ..."
246	export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
247	/bin/rm -fr $(websitedir)
248	mkdir -p $(websitedir)
249	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(websitedir)/ $(XSL_WEBSITE_STYLE) $(myxmldir)/index.xml
250
251# valkyrie carries around her own copy of the valgrind manual
252valkyrie-docs:
253	@echo "Generating a set of valgrind docs for valkyrie..."
254	export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
255	/bin/rm -fr $(valkyriedir)
256	mkdir -p $(valkyriedir)
257	mkdir -p $(valkyriedir)/images
258	cp $(mylibdir)/vg_basic.css $(valkyriedir)/
259	cp $(myimgdir)/*.png $(valkyriedir)/images/
260	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(valkyriedir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
261
262# html.tar.bz2, .pdf, .ps.bz2 files for downloading from the website
263download-docs:
264	export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
265	/bin/rm -fr $(downloadsdir)
266	mkdir -p $(downloadsdir)
267	@echo ""
268	@echo "Generating valgrind_manual.html.tar.bz2 ..."
269	export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
270	/bin/rm -fr $(vgdir)
271	mkdir -p $(vgdir)
272	mkdir -p $(vgdir)/html
273	mkdir -p $(vgdir)/html/images
274	cp $(mylibdir)/vg_basic.css $(vgdir)/html/
275	cp $(myimgdir)/*.png $(vgdir)/html/images/
276	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/html/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml
277	(cd $(top_builddir)/docs/ && \
278		(tar cfj $(downloadsdir)/valgrind_manual.html.tar.bz2 ./valgrind/html/ ) )
279	/bin/rm -fr $(vgdir)/html/
280	@echo ""
281	@echo "Generating valgrind_manual.pdf ..."
282	mkdir -p $(vgdir)/print
283	mkdir -p $(vgdir)/print/images
284	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/print/manual.fo $(XSL_FO_STYLE) $(myxmldir)/index.xml
285	(cd $(vgdir)/print/ && \
286		( pdfxmltex manual.fo && \
287		  pdfxmltex manual.fo && \
288		  pdfxmltex manual.fo ) &> $(LOGFILE) < /dev/null )
289	@echo ""
290	@echo "Generating valgrind_manual.ps.bz2 ..."
291	(cd $(vgdir)/print/ && \
292		( pdftops manual.pdf ) )
293	mv $(vgdir)/print/manual.pdf $(downloadsdir)/valgrind_manual.pdf
294	mv $(vgdir)/print/manual.ps $(downloadsdir)/valgrind_manual.ps
295	bzip2 $(downloadsdir)/valgrind_manual.ps
296	/bin/rm -fr $(vgdir)
297