PATCH: Move DocBook Makefile rules into csl-docbook

Mark Mitchell mark at codesourcery.com
Tue Dec 13 01:37:54 UTC 2005


Since the point of the csl-docbook module is to provide reusable
DocBook infrastructures for other CodeSourcery projects, it makes
sense for the Makefile rules to live there.  This patch relocates
DocBook stuff from the VSIPL++ Makefile into the csl-docbook Makefile.

Committed.

--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com

2005-12-12  Mark Mitchell  <mark at codesourcery.com>

	* GNUmakefile.in: Rely on csl-docbook/GNUmakefile.inc for DocBook
	rules.
	* doc/tex.dsl: Remove.
	* doc/wraptex: Likewise.

2005-12-12  Mark Mitchell  <mark at codesourcery.com>

	* GNUmakefile.inc: New file.
	* wraptex: New file.
	* dsl/tex.dsl: Likewise.

Index: GNUmakefile.in
===================================================================
RCS file: /home/cvs/Repository/vpp/GNUmakefile.in,v
retrieving revision 1.28
diff -c -5 -p -r1.28 GNUmakefile.in
*** GNUmakefile.in	12 Dec 2005 15:12:00 -0000	1.28
--- GNUmakefile.in	13 Dec 2005 01:31:51 -0000
*************** JADE := 
*** 84,112 ****
  PDFJADETEX := 
  # The command used to turn XSL-FO into PDF.
  XEP := @XEP@
  # The command used to turn DocBook into HTML or XSL-FO.
  XSLTPROC := @XSLTPROC@
! # If XEP is available, use the XEP extensions when generating XSL-FO.
! ifdef XEP
! XSLTPROCFOFLAGS := --stringparam xep.extensions 1
! endif
! # The patch to the SGML declaration of XML.
! XML_DCL := xml.dcl
! 
! ifdef XSLTPROC
! docbook_html := yes
! ifdef XEP
! docbook_pdf := yes
! endif
! endif
! 
! ifdef JADE
! ifdef PDFJADETEX
! docbook_pdf := yes
! endif
! endif
  
  ########################################################################
  # Subdirectory Variables
  ########################################################################
  
--- 84,95 ----
  PDFJADETEX := 
  # The command used to turn XSL-FO into PDF.
  XEP := @XEP@
  # The command used to turn DocBook into HTML or XSL-FO.
  XSLTPROC := @XSLTPROC@
! # The location of the csl-docbook directory.
! csldocbookdir := $(srcdir)/doc/csl-docbook
  
  ########################################################################
  # Subdirectory Variables
  ########################################################################
  
*************** dir_var  = $($(call norm_dir,$(1))$(2))
*** 183,192 ****
--- 166,177 ----
  
  ########################################################################
  # Implicit Rules
  ########################################################################
  
+ include $(csldocbookdir)/GNUmakefile.inc
+ 
  # Compile a C++ source file.  In addition to $CXXFLAGS, the compiler
  # will be passed the options in $dir_CXXFLAGS, where dir is the
  # subdirectory containing the input source file, with slashes replaced
  # by underscores.
  %.$(OBJEXT): %.cpp
*************** dir_var  = $($(call norm_dir,$(1))$(2))
*** 198,250 ****
  %.d: %.cpp
  	$(SHELL) -ec '$(CXXDEP) $(CXXFLAGS) \
  		      $(call dir_var,$(dir $<),CXXFLAGS) $< \
  		      | sed "s|$(*F)\\.o[ :]*|$*\\.d $*\\.$(OBJEXT) : |g" > $@'
  
- ifdef XSLTPROC
- # Generate HTML from DocBook. 
- %.html: %.xml $(srcdir)/doc/csl-docbook/xsl/html/csl.xsl
- 	rm -rf $(@D)/html
- 	mkdir -p $(@D)/html
- 	$(XSLTPROC) \
- 	    --stringparam csl_docbook.root $(srcdir)/doc/csl-docbook \
- 	    --output $(@D)/html/index.html \
- 	    $(srcdir)/doc/csl-docbook/xsl/html/csl.xsl \
- 	    $<
- 	touch $@
- 
- # Generate XSL-FO from DocBook.
- %.fo: %.xml $(srcdir)/doc/csl-docbook/xsl/fo/csl.xsl
- 	mkdir -p $(@D)
- 	$(XSLTPROC) $(XSLTPROCFOFLAGS) \
- 	    --stringparam csl_docbook.root $(srcdir)/doc/csl-docbook \
- 	    --output $@ \
- 	    $(srcdir)/doc/csl-docbook/xsl/fo/csl.xsl \
- 	    $<
- 
- ifdef XEP
- # Generate PDF from XSL-FO.
- %.pdf: %.fo
- 	$(XEP) $<
- endif
- endif
- 
- # If we do not have XEP, then perhaps we can generate PDF using Jade.
- ifndef XEP
- ifdef JADE
- # Generate TeX from DocBook.
- %.jtex: %.xml
- 	mkdir -p $(@D)
- 	$(JADE) -t tex -d $(srcdir)/doc/tex.dsl \
- 		-o $@ $(XML_DCL) $<
- 
- # Generate PDF from TeX.
- %.pdf: %.jtex
- 	$(srcdir)/doc/wraptex $(PDFJADETEX) $<
- endif
- endif
- 
  %.syn: %.hpp
  	$(SYNOPSIS) parse --output=$@ $<
  
  vsip.syn: $(syn)
  	$(SYNOPSIS) link --output=$@ $^
--- 183,192 ----
*************** vsipdoc: vsip.syn
*** 258,288 ****
  	$(SYNOPSIS) html --output=$@ $<
  
  vsipsxr: vsip.syn
  	$(SYNOPSIS) sxr --output=$@ $<
  
- # If we do not have mechanisms for generating documentation, but the
- # documentation is present in the source directory, copy it from
- # there.
- 
- ifndef docbook_pdf
- %.pdf: 
- 	if test -r $(srcdir)/$@; then \
- 		cp $(srcdir)/$@ $@; \
- 	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
- 
  ########################################################################
  # Standard Targets
  ########################################################################
  
  # Subdirectory Makefile fragments may add to the actions to be taken
--- 200,209 ----
Index: doc/tex.dsl
===================================================================
RCS file: doc/tex.dsl
diff -N doc/tex.dsl
*** doc/tex.dsl	21 May 2005 19:06:23 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,36 ****
- <!--
- 
-   File:   tex.dsl
-   Author: Alex Samuel
-   Date:   2000-11-10
- 
-   Contents:
-     DSSSL style sheet for generating hardcopy from DocBook documents.
- 
-   Copyright (C) 2000, 2002 CodeSourcery LLC
- 
- -->
- <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" 
- [
-  <!-- This style sheet extends Norman Walsh's Modular DSSSL Docbook
-       Print Stylesheet.  -->
- 
-  <!ENTITY dbstyle 
-   PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" 
-   CDATA DSSSL>
- ]> 
- 
- <style-sheet>
- <style-specification use="docbook">
- <style-specification-body> 
- 
- ;; Customizations here.
- 
- ;; Number chapters and sections.
- (define %chapter-autolabel% #t)
- (define %section-autolabel% #t)
- 
- </style-specification-body>
- </style-specification>
- <external-specification id="docbook" document="dbstyle">
- </style-sheet>
--- 0 ----
Index: doc/wraptex
===================================================================
RCS file: doc/wraptex
diff -N doc/wraptex
*** doc/wraptex	4 Jun 2005 18:20:21 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,48 ****
- #! /bin/sh
- 
- # This helper script runs a LaTeX variant in a loop until the .aux file
- # stabilizes.
- 
- if [ $# -ne 2 ]; then
-     echo "usage: $0 TEX-VARIANT INPUT-FILE" >&2
-     exit 2
- fi
- 
- TEX="$1"
- input="$2"
- 
- case "$input" in */*)
-   indir="${input%/*}"
-   input="${input##*/}"
-   cd "$indir" || exit 1
-   ;;
- esac
- 
- ibase="${input%.*}"
- aux="$ibase".aux
- oaux="$ibase".oaux
- 
- rm -f "$aux" "$oaux"
- 
- # Run TeX once in \nonstopmode.  We expect the primary output to be
- # junk, because the aux file doesn't exist (yet).  If it fails, abort.
- 
- echo "+ $TEX -interaction=nonstopmode \"$input\""
- $TEX -interaction=nonstopmode "$input" || exit 1
- 
- # Cache the aux file that the first run produced.
- cp "$aux" "$oaux"
- 
- # Now run TeX over and over again until the .aux file stops changing.
- # We use \batchmode for these cycles - the user has already seen any
- # diagnostics of interest.
- while :; do
-     echo "+ $TEX -interaction=batchmode \"$input\""
-     $TEX -interaction=batchmode "$input" || exit 1
-     if cmp -s "$aux" "$oaux"; then
- 	break
-     fi
-     cp "$aux" "$oaux"
- done
- 
- rm -f "$oaux"
--- 0 ----
Index: doc/csl-docbook/GNUmakefile.inc
===================================================================
RCS file: doc/csl-docbook/GNUmakefile.inc
diff -N doc/csl-docbook/GNUmakefile.inc
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- doc/csl-docbook/GNUmakefile.inc	13 Dec 2005 01:31:51 -0000
***************
*** 0 ****
--- 1,128 ----
+ ########################################################################
+ #
+ # File:   GNUmakefile.inc
+ # Author: Mark Mitchell 
+ # Date:   2005-12-14
+ #
+ # Contents: Makefile fragment for DocBook
+ #
+ ########################################################################
+ 
+ ########################################################################
+ # Notes
+ ########################################################################
+ 
+ # This Makefile fragment contains rules for processing DocBook
+ # source.  To use this fragment, you must:
+ #
+ # 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
+ ########################################################################
+ 
+ # Define docbook_html to a non-empty value if we have tools available
+ # to generate HTML from DocBook.  Similarly, define docbook_pdf 
+ 
+ ifdef XSLTPROC
+ docbook_html := yes
+ ifdef XEP
+ docbook_pdf := yes
+ endif
+ endif
+ 
+ ifdef JADE
+ ifdef PDFJADETEX
+ docbook_pdf := yes
+ endif
+ endif
+ 
+ # If XEP is available, use the XEP extensions when generating XSL-FO.
+ ifdef XEP
+ XSLTPROCFOFLAGS := --stringparam xep.extensions 1
+ endif
+ 
+ # 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
+ 	rm -rf $(@D)/html
+ 	mkdir -p $(@D)/html
+ 	$(XSLTPROC) \
+ 	    --stringparam csl_docbook.root $(csldocbookdir) \
+ 	    --output $(@D)/html/index.html \
+ 	    $(csldocbookdir)/xsl/html/csl.xsl \
+ 	    $<
+ 	touch $@
+ 
+ # Generate XSL-FO from DocBook.
+ %.fo: %.xml $(csldocbookdir)/xsl/fo/csl.xsl
+ 	mkdir -p $(@D)
+ 	$(XSLTPROC) $(XSLTPROCFOFLAGS) \
+ 	    --stringparam csl_docbook.root $(csldocbookdir) \
+ 	    --output $@ \
+ 	    $(csldocbookdir)/xsl/fo/csl.xsl \
+ 	    $<
+ 
+ ifdef XEP
+ # Generate PDF from XSL-FO.
+ %.pdf: %.fo
+ 	$(XEP) $<
+ endif
+ endif
+ 
+ # If we do not have XEP, then perhaps we can generate PDF using Jade.
+ ifndef XEP
+ ifdef JADE
+ # Generate TeX from DocBook.
+ %.jtex: %.xml
+ 	mkdir -p $(@D)
+ 	$(JADE) -t tex -d $(csldocbookdir)/dsl/tex.dsl \
+ 		-o $@ $(XML_DCL) $<
+ 
+ # Generate PDF from TeX.
+ %.pdf: %.jtex
+ 	$(csldocbookdir)/wraptex $(PDFJADETEX) $<
+ endif
+ endif
+ 
+ # If we do not have mechanisms for generating documentation, but the
+ # documentation is present in the source directory, copy it from
+ # there.
+ 
+ ifndef docbook_pdf
+ %.pdf: 
+ 	if test -r $(srcdir)/$@; then \
+ 		cp $(srcdir)/$@ $@; \
+ 	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
Index: doc/csl-docbook/wraptex
===================================================================
RCS file: doc/csl-docbook/wraptex
diff -N doc/csl-docbook/wraptex
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- doc/csl-docbook/wraptex	13 Dec 2005 01:31:51 -0000
***************
*** 0 ****
--- 1,48 ----
+ #! /bin/sh
+ 
+ # This helper script runs a LaTeX variant in a loop until the .aux file
+ # stabilizes.
+ 
+ if [ $# -ne 2 ]; then
+     echo "usage: $0 TEX-VARIANT INPUT-FILE" >&2
+     exit 2
+ fi
+ 
+ TEX="$1"
+ input="$2"
+ 
+ case "$input" in */*)
+   indir="${input%/*}"
+   input="${input##*/}"
+   cd "$indir" || exit 1
+   ;;
+ esac
+ 
+ ibase="${input%.*}"
+ aux="$ibase".aux
+ oaux="$ibase".oaux
+ 
+ rm -f "$aux" "$oaux"
+ 
+ # Run TeX once in \nonstopmode.  We expect the primary output to be
+ # junk, because the aux file doesn't exist (yet).  If it fails, abort.
+ 
+ echo "+ $TEX -interaction=nonstopmode \"$input\""
+ $TEX -interaction=nonstopmode "$input" || exit 1
+ 
+ # Cache the aux file that the first run produced.
+ cp "$aux" "$oaux"
+ 
+ # Now run TeX over and over again until the .aux file stops changing.
+ # We use \batchmode for these cycles - the user has already seen any
+ # diagnostics of interest.
+ while :; do
+     echo "+ $TEX -interaction=batchmode \"$input\""
+     $TEX -interaction=batchmode "$input" || exit 1
+     if cmp -s "$aux" "$oaux"; then
+ 	break
+     fi
+     cp "$aux" "$oaux"
+ done
+ 
+ rm -f "$oaux"
Index: doc/csl-docbook/dsl/tex.dsl
===================================================================
RCS file: doc/csl-docbook/dsl/tex.dsl
diff -N doc/csl-docbook/dsl/tex.dsl
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- doc/csl-docbook/dsl/tex.dsl	13 Dec 2005 01:31:51 -0000
***************
*** 0 ****
--- 1,36 ----
+ <!--
+ 
+   File:   tex.dsl
+   Author: Alex Samuel
+   Date:   2000-11-10
+ 
+   Contents:
+     DSSSL style sheet for generating hardcopy from DocBook documents.
+ 
+   Copyright (C) 2000, 2002 CodeSourcery LLC
+ 
+ -->
+ <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" 
+ [
+  <!-- This style sheet extends Norman Walsh's Modular DSSSL Docbook
+       Print Stylesheet.  -->
+ 
+  <!ENTITY dbstyle 
+   PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" 
+   CDATA DSSSL>
+ ]> 
+ 
+ <style-sheet>
+ <style-specification use="docbook">
+ <style-specification-body> 
+ 
+ ;; Customizations here.
+ 
+ ;; Number chapters and sections.
+ (define %chapter-autolabel% #t)
+ (define %section-autolabel% #t)
+ 
+ </style-specification-body>
+ </style-specification>
+ <external-specification id="docbook" document="dbstyle">
+ </style-sheet>



More information about the vsipl++ mailing list