1#
2# Generate output formats for a single DocBook/XML with/without chapters
3#
4# Variables set by the calling Makefile:
5# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
6# docbook:  the main DocBook/XML file, no chapters, appendix or image files
7# chapters: all files pulled in by an XInclude statement and images.
8#
9
10#
11# This makefile is intended for Users Documentation and Functional Specifications.
12# Do not use for Developer Documentation which is not installed and does not require olink.
13# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
14# for an explanation on documents classification.
15#
16
17# DocBook/XML generated output formats to be installed
18shelf_DATA =
19
20# DocBook/XML file with chapters, appendix and images it includes
21dist_shelf_DATA = $(docbook) $(chapters)
22
23if HAVE_XMLTO
24if HAVE_STYLESHEETS
25
26XMLTO_SEARCHPATH_FLAGS = 				\
27	--searchpath "$(XORG_SGML_PATH)/X11" 		\
28	--searchpath "$(abs_top_builddir)"
29XMLTO_HTML_OLINK_FLAGS = \
30	--stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.html.xml \
31	--stringparam current.docid="$(<:.xml=)"
32XMLTO_HTML_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
33XMLTO_HTML_FLAGS = 					\
34	$(XMLTO_SEARCHPATH_FLAGS)			\
35	$(XMLTO_HTML_STYLESHEET_FLAGS)			\
36	$(XMLTO_HTML_OLINK_FLAGS)
37
38shelf_DATA += $(docbook:.xml=.html)
39%.html: %.xml $(chapters)
40	$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $<
41
42if HAVE_XMLTO_TEXT
43
44shelf_DATA += $(docbook:.xml=.txt)
45%.txt: %.xml $(chapters)
46	$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) txt $<
47endif HAVE_XMLTO_TEXT
48
49if HAVE_FOP
50XMLTO_FO_IMAGEPATH_FLAGS = --stringparam img.src.path=$(abs_builddir)/
51XMLTO_PDF_OLINK_FLAGS = \
52	--stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.pdf.xml \
53	--stringparam current.docid="$(<:.xml=)"
54XMLTO_FO_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
55
56XMLTO_FO_FLAGS = 					\
57	$(XMLTO_SEARCHPATH_FLAGS)			\
58	$(XMLTO_FO_STYLESHEET_FLAGS)			\
59	$(XMLTO_FO_IMAGEPATH_FLAGS)			\
60	$(XMLTO_PDF_OLINK_FLAGS)
61
62shelf_DATA += $(docbook:.xml=.pdf)
63%.pdf: %.xml $(chapters)
64	$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
65
66shelf_DATA += $(docbook:.xml=.ps)
67%.ps: %.xml $(chapters)
68	$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
69endif HAVE_FOP
70
71# Generate documents cross-reference target databases
72if HAVE_XSLTPROC
73
74XSLT_SEARCHPATH_FLAGS = 				\
75	--path "$(XORG_SGML_PATH)/X11"			\
76	--path "$(abs_top_builddir)"
77XSLT_OLINK_FLAGS = 					\
78	--stringparam targets.filename "$@" 		\
79	--stringparam collect.xref.targets "only" 	\
80	--stringparam olink.base.uri "$(@:.db=)"
81
82XSLT_HTML_FLAGS =					\
83	$(XSLT_SEARCHPATH_FLAGS) 			\
84	$(XSLT_OLINK_FLAGS)				\
85	--nonet --xinclude				\
86	$(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
87XSLT_PDF_FLAGS = 					\
88	$(XSLT_SEARCHPATH_FLAGS) 			\
89	$(XSLT_OLINK_FLAGS)				\
90	--nonet --xinclude				\
91	$(STYLESHEET_SRCDIR)/xorg-fo.xsl
92
93shelf_DATA += $(docbook:.xml=.html.db)
94%.html.db: %.xml  $(chapters)
95	$(AM_V_GEN)$(XSLTPROC) $(XSLT_HTML_FLAGS) $<
96
97shelf_DATA += $(docbook:.xml=.pdf.db)
98%.pdf.db: %.xml $(chapters)
99	$(AM_V_GEN)$(XSLTPROC) $(XSLT_PDF_FLAGS) $<
100
101endif HAVE_XSLTPROC
102endif HAVE_STYLESHEETS
103endif HAVE_XMLTO
104
105CLEANFILES = $(shelf_DATA)
106