PATCH: Provide common installation rules for DocBook
Mark Mitchell
mark at codesourcery.com
Sat Dec 24 08:13:27 UTC 2005
This patch updates csl-docbook's Makefile fragment so as to provide
installation rule templates. These honor the htmldir/pdfdir
variables, as per the GNU Coding Standards.
>From the Makefile fragment:
# 3. Use the installation templates from this file to install the
# manuals.
#
# For example, if $(pdf_manuals) is the PDF manuals, relative to
# $(objdir), do:
#
# install-pdf: $(foreach f,$(pdf_manuals),install-pdf-$(notdir $(f)))
#
# $(foreach f,$(pdf_manuals),$(eval $(call install_pdf_template,$(f))))
#
# to install all of the PDF manuals in $(pdfdir).
Applied.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
2005-12-24 Mark Mitchell <mark at codesourcery.com>
* GNUmakefile.inc (%.html): Use the target name as the name of the
directory into which the manual is placed.
(install_pdf_template): New template.
(install_html_template): Likewise.
(install-pdfdir): New rule.
(install-htmldir): Likewise.
Index: GNUmakefile.inc
===================================================================
RCS file: /home/cvs/Repository/csl-docbook/GNUmakefile.inc,v
retrieving revision 1.4
diff -c -5 -p -r1.4 GNUmakefile.inc
*** GNUmakefile.inc 19 Dec 2005 05:17:18 -0000 1.4
--- GNUmakefile.inc 24 Dec 2005 08:05:57 -0000
***************
*** 1,6 ****
! ########################################################################
#
# File: GNUmakefile.inc
# Author: Mark Mitchell
# Date: 2005-12-14
#
--- 1,6 ----
! ######################################################### -*-Makefile-*-
#
# File: GNUmakefile.inc
# Author: Mark Mitchell
# Date: 2005-12-14
#
***************
*** 18,37 ****
# 1. Set the following variables. If you do not have a particular
# tool, just leave the variable undefined, or give it an empty
# value.
#
# csldocbookdir The path to the csl-docbook directory.
# JADE The path to jade.
# PDFJADETEXT The path to pdfjadetex.
# XEP The path to the RenderX XEP program.
# XSLTPROC The path to xsltproc.
#
# 2. Use "include $(csldocbookdir)/GNUmakefile.inc" to include
# this fragment.
#
! # Then, targets with ".pdf" or ".html" extensions will be built
! # automatically from DocBook source.
########################################################################
# Configuration
########################################################################
--- 18,54 ----
# 1. Set the following variables. If you do not have a particular
# tool, just leave the variable undefined, or give it an empty
# value.
#
# csldocbookdir The path to the csl-docbook directory.
+ # htmldir The directory in which HTML manuals should
+ # be installed.
+ # pdfdir The directory in which PDF manuals should
+ # be installed.
+ #
# JADE The path to jade.
# PDFJADETEXT The path to pdfjadetex.
# XEP The path to the RenderX XEP program.
# XSLTPROC The path to xsltproc.
#
# 2. Use "include $(csldocbookdir)/GNUmakefile.inc" to include
# this fragment.
#
! # Then, targets with ".pdf" or ".html" extensions will be built
! # automatically from DocBook source.
! #
! # 3. Use the installation templates from this file to install the
! # manuals.
! #
! # For example, if $(pdf_manuals) is the PDF manuals, relative to
! # $(objdir), do:
! #
! # install-pdf: $(foreach f,$(pdf_manuals),install-pdf-$(notdir $(f)))
! #
! # $(foreach f,$(pdf_manuals),$(eval $(call install_pdf_template,$(f))))
! #
! # to install all of the PDF manuals in $(pdfdir).
########################################################################
# Configuration
########################################################################
*************** endif
*** 58,83 ****
# The patch to the SGML declaration of XML.
XML_DCL := xml.dcl
########################################################################
# Implicit Rules
########################################################################
ifdef XSLTPROC
# Generate HTML from DocBook.
%.html: %.xml \
$(csldocbookdir)/xsl/html/csl.xsl \
$(csldocbookdir)/css/cs.css
! mkdir -p $(@D)/html
! cp $(csldocbookdir)/css/cs.css $(@D)/html
$(XSLTPROC) \
--xinclude \
--stringparam csl_docbook.root $(csldocbookdir) \
--stringparam html.stylesheet cs.css \
--stringparam keep.relative.image.uris 1 \
! --output $(@D)/html/index.html \
$(csldocbookdir)/xsl/html/csl.xsl \
$<
touch $@
# Generate XSL-FO from DocBook.
--- 75,132 ----
# The patch to the SGML declaration of XML.
XML_DCL := xml.dcl
########################################################################
+ # Templates
+ ########################################################################
+
+ # Install a PDF manual.
+ define install_pdf_template
+ .PHONY: install-pdf-$(notdir $(1))
+ install-pdf-$(notdir $(1)): $(1) install-pdfdir
+ if test -r $(1); then $(INSTALL_DATA) $(1) $(pdfdir); fi
+ endef
+
+ # Install an HTML manual.
+ define install_html_template
+ .PHONY: install-html-$(notdir $(1))
+ install-html-$(notdir $(1)): $(1) install-htmldir
+ if test -r $(1); then \
+ $(INSTALL) -d $(htmldir)/$(notdir $(1)); \
+ $(INSTALL_DATA) $(1)/*.html $(htmldir)/$(notdir $(1)); \
+ $(INSTALL_DATA) $(1)/*.css $(htmldir)/$(notdir $(1)); \
+ fi
+ if test -d $(1)/images; then \
+ $(INSTALL) -d $(htmldir)/$(notdir $(1))/images; \
+ $(INSTALL_DATA) $(1)/images/*.png \
+ $(htmldir)/$(notdir $(1))/images; \
+ fi
+ if test -d $(1)/images/callouts; then \
+ $(INSTALL) -d $(htmldir)/$(notdir $(1))/images/callouts; \
+ $(INSTALL_DATA) $(1)/images/callouts/*.png \
+ $(htmldir)/$(notdir $(1))/images/callouts; \
+ fi
+ endef
+
+ ########################################################################
# Implicit Rules
########################################################################
ifdef XSLTPROC
# Generate HTML from DocBook.
%.html: %.xml \
$(csldocbookdir)/xsl/html/csl.xsl \
$(csldocbookdir)/css/cs.css
! mkdir -p $@
! cp $(csldocbookdir)/css/cs.css $@
$(XSLTPROC) \
--xinclude \
--stringparam csl_docbook.root $(csldocbookdir) \
--stringparam html.stylesheet cs.css \
--stringparam keep.relative.image.uris 1 \
! --output $@/index.html \
$(csldocbookdir)/xsl/html/csl.xsl \
$<
touch $@
# Generate XSL-FO from DocBook.
*************** ifndef docbook_pdf
*** 123,134 ****
fi
endif
ifndef docbook_html
%.html:
! if test -r $(srcdir)/$(@D)/html; then \
! rm -rf $(@D)/html; \
! mkdir -p $(@D)/html; \
! cp -r $(srcdir)/$(@D)/html/*.html $(@D)/html; \
! touch $@; \
fi
endif
--- 172,194 ----
fi
endif
ifndef docbook_html
%.html:
! if test -r $(srcdir)/$@; then \
! rm -rf $@; \
! mkdir -p $@; \
! cp -r $(srcdir)/$@ $@; \
fi
endif
+
+ ########################################################################
+ # Rules
+ ########################################################################
+
+ .PHONY: install-pdfdir
+ install-pdfdir:
+ $(INSTALL) -d $(pdfdir)
+
+ .PHONY: install-htmldir
+ install-htmldir:
+ $(INSTALL) -d $(htmldir)
More information about the vsipl++
mailing list