summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGaetan Nadon <memsize@videotron.ca>2010-11-21 14:27:58 -0500
committerKeith Packard <keithp@keithp.com>2010-11-24 11:44:35 -0800
commit7250f078c12fd20d5ac9150f54495926e5121461 (patch)
treef9987f8890872f27b2ff92cdbfce2c98cdb775cb /doc
parentf33512b70cf0350a62df2ee2287a870d5fc991a8 (diff)
doc: refactor Makefile and xmlrules.in code for reusability
A different approach which requires less variables setting and internal knowledge of the reused code. Changing from "install" to "not install" is very easy now. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/xml/Makefile.am11
-rw-r--r--doc/xml/dtrace/Makefile.am14
-rw-r--r--doc/xml/xmlrules-inst.in23
-rw-r--r--doc/xml/xmlrules-noinst.in22
-rw-r--r--doc/xml/xmlrules.in33
5 files changed, 60 insertions, 43 deletions
diff --git a/doc/xml/Makefile.am b/doc/xml/Makefile.am
index ab3839be8..6c8178a12 100644
--- a/doc/xml/Makefile.am
+++ b/doc/xml/Makefile.am
@@ -22,14 +22,9 @@
#
SUBDIRS = dtrace
+doc_sources = Xserver-spec.xml
-XML_FILES = Xserver-spec.xml
-
-include $(top_srcdir)/doc/xml/xmlrules.in
-
+# Developer's documentation is not installed
if ENABLE_DEVEL_DOCS
-noinst_DATA = $(BUILT_DOC_FILES)
+include $(top_srcdir)/doc/xml/xmlrules-noinst.in
endif
-CLEANFILES = $(CLEAN_DOC_FILES)
-
-EXTRA_DIST = $(XML_FILES)
diff --git a/doc/xml/dtrace/Makefile.am b/doc/xml/dtrace/Makefile.am
index 10b4f0452..1a5ad1511 100644
--- a/doc/xml/dtrace/Makefile.am
+++ b/doc/xml/dtrace/Makefile.am
@@ -21,18 +21,16 @@
# DEALINGS IN THE SOFTWARE.
#
-XML_FILES = Xserver-DTrace.xml
-
-include $(top_srcdir)/doc/xml/xmlrules.in
+doc_sources = Xserver-DTrace.xml
if ENABLE_DOCS
+
+# This user's documentation is installed only if tracing is available
if XSERVER_DTRACE
-doc_DATA = $(BUILT_DOC_FILES)
+include $(top_srcdir)/doc/xml/xmlrules-inst.in
else
-noinst_DATA = $(BUILT_DOC_FILES)
-endif
+include $(top_srcdir)/doc/xml/xmlrules-noinst.in
endif
-CLEANFILES = $(CLEAN_DOC_FILES)
+endif
-EXTRA_DIST = $(XML_FILES)
diff --git a/doc/xml/xmlrules-inst.in b/doc/xml/xmlrules-inst.in
new file mode 100644
index 000000000..9b9027897
--- /dev/null
+++ b/doc/xml/xmlrules-inst.in
@@ -0,0 +1,23 @@
+
+# The doc_sources variable contains one or more DocBook/XML source file.
+# The generated documents will be installed in $(docdir),
+# The DocBook/XML files will always be included in the tarball
+
+dist_doc_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+doc_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+doc_DATA += $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+doc_DATA += $(doc_sources:.xml=.txt)
+endif
+
+CLEANFILES = $(doc_DATA)
+include $(top_srcdir)/doc/xml/xmlrules.in
+
+endif HAVE_XMLTO
+
diff --git a/doc/xml/xmlrules-noinst.in b/doc/xml/xmlrules-noinst.in
new file mode 100644
index 000000000..03336521d
--- /dev/null
+++ b/doc/xml/xmlrules-noinst.in
@@ -0,0 +1,22 @@
+
+# The doc_sources variable contains one or more DocBook/XML source file.
+# The generated documents will NOT be installed in $(docdir),
+# The DocBook/XML files will always be included in the tarball
+
+dist_noinst_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+noinst_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+noinst_DATA += $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+noinst_DATA += $(doc_sources:.xml=.txt)
+endif
+
+CLEANFILES = $(noinst_DATA)
+include $(top_srcdir)/doc/xml/xmlrules.in
+
+endif HAVE_XMLTO
diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index fd34243d3..f6a2e4f7a 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -21,24 +21,15 @@
# DEALINGS IN THE SOFTWARE.
#
-# This file is included by Makefile.am in subdirectories that have
-# DocBook XML documentation files.
-#
-# No files are automatically distributed or installed by this subset of rules
-# Any files to be distributed or installed would be listed in the including
-# Makefile.am
-
-TXT_FILES = $(XML_FILES:%.xml=%.txt)
-HTML_FILES = $(XML_FILES:%.xml=%.html)
-PDF_FILES = $(XML_FILES:%.xml=%.pdf)
-
-BUILT_DOC_FILES =
-
-SUFFIXES = .xml .txt .html .pdf
+# This file provides pattern rules to generate html/pdf/txt from DocBook/XML
+# A stylesheet is used if xorg-sgml-doctools is installed
+# This file is included by xmlrules-inst.in for installable user's documentation
+# It is included by xmlrules-noinst for non installable developer's documentation
+# If the server version or release date changes, autogen && make
XML_ENT_DIR = $(abs_top_builddir)/doc/xml
+SUFFIXES = .xml .txt .html .pdf
-if HAVE_XMLTO
XMLTO_FLAGS = --searchpath $(XML_ENT_DIR)
if HAVE_STYLESHEETS
@@ -46,23 +37,11 @@ XMLTO_FLAGS += -m $(XSL_STYLESHEET) \
--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
endif
-if HAVE_XMLTO_TEXT
-BUILT_DOC_FILES += $(TXT_FILES)
%.txt: %.xml $(XML_ENT_DIR)/xserver.ent
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
-endif
-BUILT_DOC_FILES += $(HTML_FILES)
%.html: %.xml $(XML_ENT_DIR)/xserver.ent
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
-if HAVE_FOP
-BUILT_DOC_FILES += $(PDF_FILES)
%.pdf: %.xml $(XML_ENT_DIR)/xserver.ent
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
-endif
-
-endif HAVE_XMLTO
-
-CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES)
-