1#
2# Generate output formats for a single DocBook/XML with/without chapters
3#
4# This version of docbook.am handles cases where XML source is generated
5# and the html to be produced must be in chunks, one per chapter.
6# The generated source must be cleaned, installed but not distributed
7#
8# Variables set by the calling Makefile:
9# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
10# docbook:  the main DocBook/XML file, no chapters, appendix or image files
11# chapters: all files pulled in by an XInclude statement and images.
12#
13
14#
15# This makefile is intended for Users Documentation and Functional Specifications.
16# Do not use for Developer Documentation which is not installed and does not require olink.
17# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
18# for an explanation on documents classification.
19#
20
21# DocBook/XML generated output formats to be installed
22shelf_DATA = $(chapters) $(docbook)
23
24# Generated DocBook/XML source files using a perl script
25%.xml: $(top_builddir)/nls/%/Compose
26	$(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl 		\
27	 --locale="$(@:.xml=)" --output="$@" $<
28
29libX11-keys.xml: $(locales:%=%.xml)
30	$(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl 		\
31	 --index --output="$@" $(locales)
32
33if HAVE_XMLTO
34if HAVE_STYLESHEETS
35
36XMLTO_SEARCHPATH_FLAGS = 				\
37	--searchpath "$(XORG_SGML_PATH)/X11" 		\
38	--searchpath "$(abs_top_builddir)"
39XMLTO_HTML_OLINK_FLAGS = \
40	--stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.html.xml \
41	--stringparam current.docid="$(<:.xml=)"
42XMLTO_HTML_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-chunk.xsl
43XMLTO_TXT_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
44XMLTO_HTML_CHUNKING_FLAGS = 				\
45	--stringparam root.filename="$(<:.xml=)"
46XMLTO_HTML_FLAGS = 					\
47	$(XMLTO_SEARCHPATH_FLAGS)			\
48	$(XMLTO_HTML_STYLESHEET_FLAGS)			\
49	$(XMLTO_HTML_CHUNKING_FLAGS)			\
50	$(XMLTO_HTML_OLINK_FLAGS)
51XMLTO_TXT_FLAGS = 					\
52	$(XMLTO_SEARCHPATH_FLAGS)			\
53	$(XMLTO_TXT_STYLESHEET_FLAGS)			\
54	$(XMLTO_HTML_OLINK_FLAGS)
55
56shelf_DATA += $(docbook:.xml=.html) $(chapters:.xml=.html)
57%.html: %.xml  $(chapters)
58	$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) xhtml $<
59
60if HAVE_XMLTO_TEXT
61
62shelf_DATA += $(docbook:.xml=.txt)
63%.txt: %.xml $(chapters)
64	$(AM_V_GEN)$(XMLTO) $(XMLTO_TXT_FLAGS) txt $<
65endif HAVE_XMLTO_TEXT
66
67if HAVE_FOP
68XMLTO_FO_IMAGEPATH_FLAGS = --stringparam img.src.path=$(abs_builddir)/
69XMLTO_FO_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
70XMLTO_PDF_OLINK_FLAGS = \
71	--stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.pdf.xml \
72	--stringparam current.docid="$(<:.xml=)"
73XMLTO_FO_FLAGS = 					\
74	$(XMLTO_SEARCHPATH_FLAGS)			\
75	$(XMLTO_FO_STYLESHEET_FLAGS)			\
76	$(XMLTO_FO_IMAGEPATH_FLAGS)			\
77	$(XMLTO_PDF_OLINK_FLAGS)
78
79shelf_DATA += $(docbook:.xml=.pdf)
80%.pdf: %.xml $(chapters)
81	$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
82
83shelf_DATA += $(docbook:.xml=.ps)
84%.ps: %.xml $(chapters)
85	$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
86endif HAVE_FOP
87
88# Generate documents cross-reference target databases
89if HAVE_XSLTPROC
90
91XSLT_SEARCHPATH_FLAGS = 				\
92	--path "$(XORG_SGML_PATH)/X11"			\
93	--path "$(abs_top_builddir)"
94XSLT_OLINK_FLAGS = 					\
95	--stringparam targets.filename "$@" 		\
96	--stringparam collect.xref.targets "only"
97XSLT_FO_OLINK_FLAGS = 					\
98	--stringparam olink.base.uri "$(@:.db=)"
99XSLT_HTML_CHUNKING_FLAGS = 				\
100	--stringparam root.filename "$(<:.xml=)"
101
102XSLT_HTML_FLAGS = 					\
103	$(XSLT_SEARCHPATH_FLAGS) 			\
104	$(XSLT_HTML_CHUNKING_FLAGS)			\
105	$(XSLT_OLINK_FLAGS)				\
106	--nonet --xinclude				\
107	$(STYLESHEET_SRCDIR)/xorg-chunk.xsl
108
109XSLT_PDF_FLAGS = 					\
110	$(XSLT_SEARCHPATH_FLAGS) 			\
111	$(XSLT_OLINK_FLAGS)				\
112	$(XSLT_FO_OLINK_FLAGS)				\
113	--nonet --xinclude				\
114	$(STYLESHEET_SRCDIR)/xorg-fo.xsl
115
116shelf_DATA += $(docbook:.xml=.html.db)
117%.html.db: %.xml  $(chapters)
118	$(AM_V_GEN)$(XSLTPROC) $(XSLT_HTML_FLAGS) $<
119
120shelf_DATA += $(docbook:.xml=.pdf.db)
121%.pdf.db: %.xml $(chapters)
122	$(AM_V_GEN)$(XSLTPROC) $(XSLT_PDF_FLAGS) $<
123
124endif HAVE_XSLTPROC
125endif HAVE_STYLESHEETS
126endif HAVE_XMLTO
127
128CLEANFILES = $(shelf_DATA)
129