summaryrefslogtreecommitdiff
path: root/docs/Makefile.am
blob: e266b30d1a0b0cd5fcfd28724c032b04c90f0bef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
SUBDIRS = xml lib images internals

EXTRA_DIST = README

dist_man_MANS = valgrind.1

##-------------------------------------------------------------------
## Below here is more ordinary make stuff...
##-------------------------------------------------------------------
docdir   = ./
xmldir   = $(docdir)xml
imgdir   = $(docdir)images
libdir   = $(docdir)lib
htmldir  = $(docdir)html
printdir = $(docdir)print

XML_CATALOG_FILES = /etc/xml/catalog

# file to log print output to
LOGFILE = print.log

# validation stuff
XMLLINT       = xmllint
LINT_FLAGS    = --noout --xinclude --noblanks --postvalid
VALID_FLAGS   = --dtdvalid http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd 
XMLLINT_FLAGS = $(LINT_FLAGS) $(VALID_FLAGS)

# stylesheet processor
XSLTPROC       = xsltproc
XSLTPROC_FLAGS = --nonet --xinclude 

# stylesheets
XSL_HTML_CHUNK_STYLE  = $(libdir)/vg-html-chunk.xsl
XSL_HTML_SINGLE_STYLE = $(libdir)/vg-html-single.xsl
XSL_FO_STYLE          = $(libdir)/vg-fo.xsl

all-docs: html-docs print-docs

valid:
	$(XMLLINT) $(XMLLINT_FLAGS) $(xmldir)/index.xml

# chunked html
html-docs:
	@echo "Generating html files..."
	export XML_CATALOG_FILES=$(XML_CATALOG_FILES)
	mkdir -p $(htmldir)
	/bin/rm -fr $(htmldir)/
	mkdir -p $(htmldir)/
	mkdir -p $(htmldir)/images
	cp $(libdir)/vg_basic.css $(htmldir)/
	cp $(imgdir)/*.png $(htmldir)/images
	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(htmldir)/ $(XSL_HTML_CHUNK_STYLE) $(xmldir)/index.xml

# pdf and postscript
print-docs:
	@echo "Generating PDF file: $(printdir)/index.pdf (please be patient)...";
	export XML_CATALOG_FILES=$(XML_CATALOG_FILES);
	mkdir -p $(printdir);
	mkdir -p $(printdir)/images;
	cp $(imgdir)/massif-graph-sm.png $(printdir)/images;
	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $(printdir)/index.fo $(XSL_FO_STYLE) $(xmldir)/index.xml;
	(cd $(printdir); \
	 pdfxmltex index.fo &> $(LOGFILE); \
	 pdfxmltex index.fo &> $(LOGFILE); \
	 pdfxmltex index.fo &> $(LOGFILE); \
	 echo "Generating PS file: $(printdir)/index.ps ..."; \
	 pdftops index.pdf; \
	 rm *.log *.aux *.fo *.out)

# If the docs have been built, install them.  But don't worry if they have 
# not -- developers do 'make install' not from a 'make dist'-ified distro all
# the time.
install-data-hook:
	if test -r html ; then \
		mkdir -p $(DESTDIR)$(datadir)/doc/valgrind/; \
		cp -r html $(DESTDIR)$(datadir)/doc/valgrind/; \
	fi

dist-hook: html-docs
	cp -r html $(distdir)	

distclean-local:
	rm -rf html print