1# ----------------------------------------------------------------------
2# $Id: Makefile.am,v 1.52 2007/02/25 22:28:05 stevecheng Exp $
3#
4# This Makefile builds the documentation for docbook2X in various
5# formats.
6#
7# Unfortunately, you must not use VPATH builds if you want
8# the converted documentation to end up in the right place
9# for the docbook2X distribution.  (It's an automake limitation
10# that takes too much effort to work around.)
11#
12
13include $(top_srcdir)/docbuild.mk
14
15# ----------------------------------------------------------------------
16#
17# Document info
18#
19
20# Stylesheets
21XSLT_MAN = $(srcdir)/ss-man.xsl
22XSLT_TEXI = $(srcdir)/ss-texinfo.xsl
23XSLT_HTML = $(srcdir)/ss-html.xsl
24
25XML_FILES = docbook2X.xml \
26	changes.xml charsets.xml design-notes.xml faq.xml manpages.xml \
27	quickstart.xml texinfo.xml textents.xml todo.xml xsltproc.xml \
28	perf.xml testing.xml install.xml \
29	i18n-system-property/i18n-system-property.xml
30
31HTML_FILES = changes.html charsets.html cindex.html design-notes.html \
32	db2x_manxml.html db2x_texixml.html db2x_xsltproc.html \
33	sgml2xml-isoent.html docbook2X.html faq.html manpages.html \
34	texinfo.html todo.html utf8trans.html xsltproc.html \
35	performance.html testing.html install.html dependencies.html \
36        docbook2man.html docbook2texi.html
37
38MAN_FILES = db2x_manxml.1 db2x_texixml.1 db2x_xsltproc.1 utf8trans.1 \
39	docbook2man.1 docbook2texi.1 sgml2xml-isoent.1
40
41INFO_FILES = docbook2X.info
42TEXI_FILES = docbook2X.texi
43
44XSL_FILES = ss-man.xsl ss-texinfo.xsl ss-html.xsl
45
46DOC = docbook2X
47DOC_XML = $(DOC).xml
48
49
50
51# ----------------------------------------------------------------------
52#
53# Validation
54#
55
56if HAVE_XMLLINT
57DOC_VAL = .$(DOC).valid
58$(DOC_VAL): $(XML_FILES)
59	$(XMLLINT) --noout --valid $<
60	touch $(DOC_VAL)
61DOC_DEP = $(DOC_VAL)
62
63validate: $(DOC_VAL)
64
65else
66DOC_DEP = $(XML_FILES)
67endif
68
69
70
71# ----------------------------------------------------------------------
72#
73# User targets
74#
75
76.PHONY: all html man texi
77
78all: html man info
79
80html: $(DOC).html
81man: $(MAN_FILES)
82texi: $(DOC).texi
83info: $(DOC).info
84
85
86# ----------------------------------------------------------------------
87#
88# HTML conversion
89#
90
91if HAVE_HTML_XSL
92$(HTML_FILES): $(DOC_XML) $(DOC_DEP) $(XSLT_HTML)
93	$(db2x_xsltproc) -s $(XSLT_HTML) $<
94if HAVE_TIDY
95	-$(TIDY) -q -m -f /dev/null \
96		--doctype strict --output-xhtml true --add-xml-decl false \
97		$(HTML_FILES)
98endif
99endif
100
101
102# ----------------------------------------------------------------------
103#
104# Texinfo conversion
105#
106
107$(DOC).txml: $(DOC_XML) $(DOC_DEP) $(XSLT_TEXI)
108	$(db2x_xsltproc) -s $(XSLT_TEXI) \
109		--string-param install-datadir="$(datadir)/docbook2X/" \
110		-o $@ $<
111
112$(DOC).texi: $(DOC).txml
113	$(db2x_texixml) $<
114
115# Stupid makeinfo uses the POSIX locale for localizing documents
116$(DOC).info: $(DOC).texi
117	LANG=C makeinfo $<
118
119
120# ----------------------------------------------------------------------
121#
122# Man page conversion
123#
124
125$(DOC).mxml: $(DOC_XML) $(DOC_DEP) $(XSLT_MAN)
126	$(db2x_xsltproc) -s $(XSLT_MAN) \
127		--string-param header-4="docbook2X $(VERSION)" \
128		--string-param install-datadir="$(datadir)/docbook2X/" \
129		-o $@ $<
130
131$(MAN_FILES): $(DOC).mxml
132	$(db2x_manxml) --solinks $<
133
134# The use of $(srcdir) below is strange, and arguably not correct
135# for VPATH builds; however, check gets called by automake's distcheck,
136# which breaks if we do not use $(srcdir) here.
137check: $(DOC).mxml
138if HAVE_GROFF
139	$(GROFF) -man -Tutf8 -z -w all $(srcdir)/*.1 2>&1 | grep "warning: " ; test $$? -eq 1
140endif
141	$(db2x_perl) $(top_srcdir)/test/htest-man.pl $(srcdir)/*.1
142
143# Use for screenshot on Web site
144demo-man.ps: $(MAN_FILES)
145	groff -Tps -man $(srcdir)/docbook2man.1 $(srcdir)/docbook2texi.1 \
146			$(srcdir)/db2x_manxml.1 $(srcdir)/db2x_texixml.1 \
147			$(srcdir)/db2x_xsltproc.1 $(srcdir)/sgml2xml-isoent.1 \
148			$(srcdir)/utf8trans.1 > demo-man.ps
149
150# ----------------------------------------------------------------------
151#
152# The INSTALL, NEWS files
153#
154# The call to 'tr' is there because I absolutely hate the ugly
155# fake directional ASCII quotes.
156#
157# Important: This rule doesn't work when configured for a VPATH build;
158#            and it is not worthwhile to try to fix it because
159#            it is a dangerous command anyway (it changes
160#            the INSTALL file in the distribution).
161install.txt: install2.xml install.xml textents.xml
162	$(db2x_xsltproc) -s $(XSLT_TEXI) install2.xml | $(db2x_texixml) --plaintext --to-stdout | tr \` \' > install.txt
163	cp install.txt ../INSTALL
164
165# ----------------------------------------------------------------------
166#
167# Distribution (automake)
168#
169
170EXTRA_DIST = $(XML_FILES) install2.xml $(MAN_FILES) $(HTML_FILES) \
171	$(XSL_FILES) docbook2X.css \
172	$(DOC).mxml $(DOC).txml .$(DOC).valid
173# We include the last three files in the distribution, even though
174# they are auto-generated, so that we don't trigger unnecessary
175# rebuilding of the documentation on the user's end.
176
177# Don't include big ass texinfo.tex
178AUTOMAKE_OPTIONS = no-texinfo.tex
179
180# ----------------------------------------------------------------------
181#
182# Install (automake)
183#
184
185htmldir = $(datadir)/doc/docbook2X
186
187man_MANS = $(MAN_FILES)
188html_DATA = $(HTML_FILES)
189info_TEXINFOS = docbook2X.texi
190
191
192# ----------------------------------------------------------------------
193#
194# Clean (automake)
195#
196
197MAINTAINERCLEANFILES = $(MAN_FILES) $(HTML_FILES) \
198	$(INFO_FILES) $(TEXI_FILES) \
199	$(DOC).mxml $(DOC).txml $(DOC_VAL)
200
201.DELETE_ON_ERROR:
202
203