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>
This commit is contained in:
Gaetan Nadon 2010-11-21 14:27:58 -05:00 committed by Keith Packard
parent f33512b70c
commit 7250f078c1
7 changed files with 66 additions and 55 deletions

View File

@ -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)

View File

@ -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)

23
doc/xml/xmlrules-inst.in Normal file
View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -19,14 +19,12 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
XML_FILES = dmx.xml scaled.xml
include $(top_srcdir)/doc/xml/xmlrules.in
doc_sources = dmx.xml scaled.xml
# 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)
if HAVE_DOXYGEN

View File

@ -19,13 +19,9 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
XML_FILES = DESIGN.xml
include $(top_srcdir)/doc/xml/xmlrules.in
doc_sources = DESIGN.xml
# 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)