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