3 # $Date: 2008-03-03 01:20:29 -0800 (Mon, 03 Mar 2008) $
 
   7 # -----------------------------------------------------------------
 
   8 #  ** Makefile.DocBook -- generate output from DocBook sources **
 
   9 # -----------------------------------------------------------------
 
  11 #   This file is part of the DocBook Project XSL Stylesheet
 
  14 #   See http://docbook.sourceforge.net/release/xsl/current/
 
  15 #   for copyright and other information.
 
  17 # DOCBOOK_OUTPUT_FORMATS is the default set of targets (output
 
  18 # formats) that get built when you type "make" without any targets
 
  19 # explicitly specified. To generate a different set of output
 
  20 # formats, change the value of DOCBOOK_OUTPUT_FORMATS here or set
 
  21 # it in your environment; for example:
 
  23 #   set DOCBOOK_OUTPUT_FORMATS="html pdf"; export DOCBOOK_OUTPUT_FORMATS
 
  25 # Of course by explicitly specifying particular targets when you
 
  26 # invoke "make", you can always override generation of the default
 
  27 # set of targets; for example:
 
  31 # That would generate just HTML (unchunked) and plain-text output.
 
  33 DOCBOOK_OUTPUT_FORMATS ?= xml man man-pdf chunk txt pdf
 
  35 # If you want XHTML output instead of HTML, set HTML_OR_XHTML to
 
  36 # 'xhtml' or just specify 'xhtml" in DOCBOOK_OUTPUT_FORMATS.
 
  37 ifeq ($(findstring xhtml,$(DOCBOOK_OUTPUT_FORMATS)),)
 
  40 HTML_OR_XHTML ?= xhtml
 
  43 # if your source is in asciidoc instead of DocBook, set
 
  44 # ASCII_OR_DOCBOOK to "ascii"
 
  45 ASCII_OR_DOCBOOK ?= docbook
 
  47 # -----------------------------------------------------------------
 
  48 #                *** TOOLS and other DEPENDENCIES ***
 
  49 # -----------------------------------------------------------------
 
  50 # we use rmdir(1) to remove dirs we create for chunked HTML output
 
  52 # "-p" causes empty parent dirs to be deleted as well
 
  53 RMDIR_FLAGS = --ignore-fail-on-non-empty -p
 
  55 # possible values for PDF_MAKER are:
 
  56 #   dblatex|fop|xep|xmlroff|passivetex
 
  59 # possible values for TXT_MAKER are:
 
  60 #   links|lynx|w3m|w3mmee
 
  62 TXT_MAKER_FLAGS = -dump
 
  66 XSLT_FLAGS = --xinclude
 
  68 # http://dblatex.sourceforge.net/
 
  70 DBLATEX_FLAGS = -b pdftex
 
  78 # http://xmlroff.sourceforge.net/
 
  88 # http://docbook2x.sourceforge.net/
 
  89 DB2X_XSLTPROC = db2x_xsltproc
 
  91 DB2X_TEXIXML = db2x_texixml
 
  94 # we call the man(1) command to generate "foo.N.pdf" and
 
  95 # "foo.N.txt" output (see "man-pdf" & "man-txt" targets)
 
  99 # The "ps2pdf" command is part of GhostSript (gs) distro.
 
 100 # It is just a wrapper script around gs that does this:
 
 102 #   gs -dCompatibilityLevel=1.2 -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
 
 103 #     "-sOutputFile=$outfile" -dCompatibilityLevel=1.2 -c .setpdfwrite -f "$infile"
 
 105 # Where, for example: $outfile = foo.pdf and $infile = foo.1
 
 109 # asciidoc is used to generate DocBook XML from asciidoc source
 
 113 # asciidoc source seems to have DOS line endings, so we use
 
 114 # DOS2UNIX to be able to grep them correctly
 
 118 # The "col" command is needed for stripping backspaces and
 
 119 # underscores from man(1) output to get pure plain-text
 
 123 # The "expand" command is needed for expanding tabs from files
 
 124 # generated from "man foo.1 | col -b" output
 
 125 # output to get pure plain-text
 
 129 # value of DOCBOOK_XSL should either be the canonical
 
 130 # (docbook.sourceforge.net) URL for the DocBook Project XSL
 
 131 # stylesheets OR it can be a local system path
 
 132 DOCBOOK_XSL = http://docbook.sourceforge.net/release/xsl/current
 
 134 # -----------------------------------------------------------------
 
 135 #       names of some DIRECTORIES and FILES we need
 
 136 # -----------------------------------------------------------------
 
 137 # We create a tmp directory once per make invocation; it's needed
 
 138 # for holding a temporary copy of the custom DBLaTeX stylesheet
 
 139 # (because dblatex currently can't read a stylesheet from stdin)
 
 141 TMPNUM := $(shell echo $$$$)
 
 142 DOCBOOK_TMP := $(TMP)/docbook-make-$(TMPNUM)
 
 144 # MAN_MANIFEST_EXT is file extension added to individual manifest
 
 146 MAN_MANIFEST_EXT = manifest_man
 
 148 # HTML_MANIFEST_EXT is file extension added to HTML manifest files
 
 149 HTML_MANIFEST_EXT = manifest_html
 
 151 # BASEDIR_SUFFIX is a what you need to set if you want a suffix
 
 152 # added to the end of each "base.dir" we create while generating
 
 153 # chunked HTML output
 
 154 #BASEDIR_SUFFIX = -html
 
 155 #BASEDIR_SUFFIX = _html
 
 158 # -----------------------------------------------------------------
 
 160 # -----------------------------------------------------------------
 
 161 # HTML_STYLESHEET -> $html.stylesheet stylesheet param
 
 162 # http://docbook.sourceforge.net/snapshots/xsl/doc/html/html.stylesheet.html
 
 163 HTML_STYLESHEET = style.css
 
 164 # HTML_IMAGES -> $admon.graphics.path
 
 165 # http://docbook.sourceforge.net/snapshots/xsl/doc/html/admon.graphics.path.html
 
 166 HTML_IMAGES = images/
 
 167 # HTML_IMAGES_EXT -> $admon.graphics.extension
 
 168 # http://docbook.sourceforge.net/snapshots/xsl/doc/html/admon.graphics.extension.html
 
 169 HTML_IMAGES_EXT = .png
 
 171 # use these to set params on the command-line
 
 172 # format is, e.g., HTML_PARAMS="--stringparam variablelist.as.table 1..."
 
 177 # DBX_PARAMS is for dblatex(1); format uses "-p":
 
 178 # DBX_PARAMS="-p doc.publisher.show 1 -p term.breakline 1...
 
 181 # What file extension do you use for DocBook source files?
 
 182 DOCBOOK_FILE_EXTENSION = .xml
 
 184 # -----------------------------------------------------------------
 
 185 #       make(1) functions for building file lists
 
 186 # -----------------------------------------------------------------
 
 188 #    the values of the following are used for determing what needs
 
 189 #    to be built and/or cleaned up
 
 191 ifeq ($(ASCII_OR_DOCBOOK),docbook)
 
 192 SOURCE_FILES_DBK = $(wildcard *$(DOCBOOK_FILE_EXTENSION))
 
 194 SOURCE_FILES_DBK = $(foreach base,$(basename $(wildcard *.txt)),$(base)$(DOCBOOK_FILE_EXTENSION))
 
 197 FILES_FO   = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).fo)
 
 198 FILES_TXT  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).out.txt)
 
 199 FILES_PDF  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).pdf)
 
 200 FILES_LOG  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).log)
 
 201 FILES_OUT  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).out)
 
 202 FILES_AUX  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).aux)
 
 203 FILES_HTML = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).html)
 
 204 FILES_INFO = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).info)
 
 205 DIRS_CHUNK = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base)$(BASEDIR_SUFFIX))
 
 206 LISTS_HTML = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).$(HTML_MANIFEST_EXT))
 
 207 LISTS_MAN  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).$(MAN_MANIFEST_EXT))
 
 208 FILES_CHNK = $(shell for manifest in $(LISTS_HTML); do if [ -f "$$manifest" ]; then cat $$manifest; fi done)
 
 209 FILES_MAN  = $(shell for manifest in $(LISTS_MAN);  do if [ -f "$$manifest" ]; then cat $$manifest; fi done)
 
 210 FILES_MANP = $(foreach base,$(FILES_MAN),$(base).man.pdf)
 
 211 FILES_MANT = $(foreach base,$(FILES_MAN),$(base).out.txt)
 
 212 DIRS_MAN   = $(shell for file in $(FILES_MAN); do dirname $$file; done | uniq)
 
 214 # -----------------------------------------------------------------
 
 215 #   ** stylesheet for testing whether a file has a refentry
 
 216 # -----------------------------------------------------------------
 
 217 REFENTRY_CHECK := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
 
 219                 xmlns:db="http://docbook.org/ns/docbook" \
 
 221   <xsl:output method="text"/> \
 
 222   <xsl:template match="/"> \
 
 223     <xsl:if test="//refentry|//db:refentry"> \
 
 224       <xsl:text>true</xsl:text> \
 
 229 # -----------------------------------------------------------------
 
 230 #             ** Stylesheet Customization Layers ** 
 
 231 # -----------------------------------------------------------------
 
 234 DBX_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
 
 236   <xsl:param name="co.linkends.show">0</xsl:param> \
 
 237   <xsl:param name="callout.markup.circled">1</xsl:param> \
 
 238   <xsl:param name="callout.linkends.hot">0</xsl:param> \
 
 239   <xsl:param name="doc.publisher.show">1</xsl:param> \
 
 240   <xsl:param name="term.breakline">1</xsl:param> \
 
 241   <xsl:param name="doc.alignment">left</xsl:param> \
 
 242   <xsl:param name="newtbl.use">1</xsl:param> \
 
 243   <xsl:param name="latex.hyperparam"/> \
 
 244   <xsl:param name="latex.style">docbook</xsl:param> \
 
 245   <xsl:param name="latex.biblio.output">all</xsl:param> \
 
 246   <xsl:param name="latex.bibfiles">""</xsl:param> \
 
 247   <xsl:param name="latex.bibwidelabel">WIDELABEL</xsl:param> \
 
 248   <xsl:param name="latex.output.revhistory">0</xsl:param> \
 
 249   <xsl:param name="latex.figure.position">[htbp]</xsl:param> \
 
 250   <xsl:param name="latex.figure.boxed">0</xsl:param> \
 
 251   <xsl:param name="latex.babel.use">1</xsl:param> \
 
 252   <xsl:param name="latex.babel.language"></xsl:param> \
 
 253   <xsl:param name="latex.class.options">twoside</xsl:param> \
 
 254   <xsl:param name="biblioentry.item.separator">, </xsl:param> \
 
 255   <xsl:param name="refentry.xref.manvolnum">1</xsl:param> \
 
 256   <xsl:param name="refsynopsis.title">Synopsis</xsl:param> \
 
 257   <xsl:param name="refnamediv.title"></xsl:param> \
 
 258   <xsl:param name="funcsynopsis.style">ansi</xsl:param> \
 
 259   <xsl:param name="funcsynopsis.decoration">1</xsl:param> \
 
 260   <xsl:param name="function.parens">0</xsl:param> \
 
 261   <xsl:param name="classsynopsis.default.language">java</xsl:param> \
 
 262   <xsl:param name="show.comments">0</xsl:param> \
 
 266 FO_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
 
 267                 xmlns:fo="http://www.w3.org/1999/XSL/Format" \
 
 269   <xsl:import href="$(DOCBOOK_XSL)/fo/docbook.xsl"/> \
 
 270   <xsl:param name="$(PDF_MAKER).extensions">1</xsl:param> \
 
 271   <xsl:param name="paper.type">A4</xsl:param> \
 
 272   <xsl:param name="draft.watermark.image"></xsl:param> \
 
 273   <xsl:param name="hyphenation">false</xsl:param> \
 
 274   <xsl:param name="hyphenate.verbatim">1</xsl:param> \
 
 275   <xsl:param name="alignment">left</xsl:param> \
 
 276   <xsl:param name="refentry.generate.name">1</xsl:param> \
 
 277   <xsl:param name="refentry.generate.title">0</xsl:param> \
 
 278   <xsl:param name="refentry.pagebreak">1</xsl:param> \
 
 279   <xsl:param name="shade.verbatim">1</xsl:param> \
 
 280   <xsl:param name="variablelist.as.blocks">1</xsl:param> \
 
 281   <xsl:param name="ulink.show">1</xsl:param> \
 
 282   <xsl:param name="ulink.footnotes">1</xsl:param> \
 
 283   <xsl:param name="index.on.type">1</xsl:param> \
 
 284   <xsl:attribute-set name="xref.properties"> \
 
 285     <xsl:attribute name="color">blue</xsl:attribute> \
 
 286   </xsl:attribute-set> \
 
 287   <xsl:attribute-set name="shade.verbatim.style"> \
 
 288     <xsl:attribute name="background-color">\#E0E0E0</xsl:attribute> \
 
 289     <xsl:attribute name="padding-left">4pt</xsl:attribute> \
 
 290     <xsl:attribute name="padding-right">4pt</xsl:attribute> \
 
 291     <xsl:attribute name="padding-top">4pt</xsl:attribute> \
 
 292     <xsl:attribute name="padding-bottom">4pt</xsl:attribute> \
 
 293   </xsl:attribute-set> \
 
 294   <xsl:attribute-set name="section.title.level1.properties"> \
 
 295     <xsl:attribute name="font-size"> \
 
 296       <xsl:value-of select="$$body.font.master * 1.5"></xsl:value-of> \
 
 297       <xsl:text>pt</xsl:text> \
 
 299   </xsl:attribute-set> \
 
 300   <xsl:attribute-set name="section.title.level2.properties"> \
 
 301     <xsl:attribute name="font-size"> \
 
 302       <xsl:value-of select="$$body.font.master * 1.3"></xsl:value-of> \
 
 303       <xsl:text>pt</xsl:text> \
 
 305   </xsl:attribute-set> \
 
 306   <xsl:attribute-set name="section.title.level3.properties"> \
 
 307     <xsl:attribute name="font-size"> \
 
 308       <xsl:value-of select="$$body.font.master * 1.1"></xsl:value-of> \
 
 309       <xsl:text>pt</xsl:text> \
 
 311   </xsl:attribute-set> \
 
 312   <xsl:attribute-set name="section.title.level4.properties"> \
 
 313     <xsl:attribute name="font-size"> \
 
 314       <xsl:value-of select="$$body.font.master"></xsl:value-of> \
 
 315       <xsl:text>pt</xsl:text> \
 
 317   </xsl:attribute-set> \
 
 318   <xsl:attribute-set name="component.title.properties"> \
 
 319     <xsl:attribute name="font-size"> \
 
 320       <xsl:value-of select="$$body.font.master * 1.5"></xsl:value-of> \
 
 321       <xsl:text>pt</xsl:text> \
 
 323   </xsl:attribute-set> \
 
 324   <xsl:attribute-set name="monospace.verbatim.properties"> \
 
 325     <xsl:attribute name="wrap-option">wrap</xsl:attribute> \
 
 326     <xsl:attribute name="hyphenation-character">\</xsl:attribute> \
 
 327     <xsl:attribute name="font-size"> \
 
 328       <xsl:value-of select="$$body.font.master * 0.8"></xsl:value-of> \
 
 329       <xsl:text>pt</xsl:text> \
 
 331   </xsl:attribute-set> \
 
 334 # for single-file (X)HTML outpout
 
 335 HTML_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
 
 337   <xsl:import href="$(DOCBOOK_XSL)/$(HTML_OR_XHTML)/docbook.xsl"/> \
 
 338   <xsl:param name="gentext.custom">local.l10n.xml</xsl:param> \
 
 339   <xsl:param name="local.l10n.xml" select="document($$gentext.custom)"/> \
 
 340   <xsl:param name="refentry.generate.name">1</xsl:param> \
 
 341   <xsl:param name="refentry.generate.title">0</xsl:param> \
 
 342   <xsl:param name="root.filename"></xsl:param> \
 
 343   <xsl:param name="variablelist.as.table">0</xsl:param> \
 
 344   <xsl:param name="html.stylesheet">$(HTML_STYLESHEET)</xsl:param> \
 
 345   <xsl:param name="admon.graphics">0</xsl:param> \
 
 346   <xsl:param name="index.on.type">1</xsl:param> \
 
 349 # for chunked (X)HTML output
 
 350 CHNK_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
 
 352   <xsl:import href="$(DOCBOOK_XSL)/$(HTML_OR_XHTML)/chunk.xsl"/> \
 
 353   <xsl:param name="refentry.generate.name">0</xsl:param> \
 
 354   <xsl:param name="refentry.generate.title">1</xsl:param> \
 
 355   <xsl:param name="variablelist.as.table">0</xsl:param> \
 
 356   <xsl:param name="html.stylesheet">$(HTML_STYLESHEET)</xsl:param> \
 
 357   <xsl:param name="admon.graphics">1</xsl:param> \
 
 358   <xsl:param name="admon.graphics.path">$(HTML_IMAGES)</xsl:param> \
 
 359   <xsl:param name="admon.graphics.extension">$(HTML_IMAGES_EXT)</xsl:param> \
 
 360   <xsl:param name="root.filename"></xsl:param> \
 
 361   <xsl:param name="generate.manifest">1</xsl:param> \
 
 362   <xsl:param name="use.id.as.filename">1</xsl:param> \
 
 363   <xsl:param name="chunker.output.indent">yes</xsl:param> \
 
 364   <xsl:param name="index.on.type">1</xsl:param> \
 
 367 # for man-page output
 
 368 MAN_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
 
 370   <xsl:import href="$(DOCBOOK_XSL)/manpages/docbook.xsl"/> \
 
 371   <xsl:param name="man.output.manifest.enabled" select="1"/> \
 
 372   <xsl:param name="man.output.in.separate.dir" select="1"/> \
 
 373   <xsl:param name="man.output.base.dir">man/</xsl:param> \
 
 374   <xsl:param name="man.output.subdirs.enabled" select="1"/> \
 
 377 # -----------------------------------------------------------------
 
 378 #                  ** TARGETS START HERE ** 
 
 379 # -----------------------------------------------------------------
 
 380 #  prevents make from deleting, e.g. foo.1, after making foo.1.pdf
 
 381 #  and foo.1.txt from it.
 
 382 .PRECIOUS: %.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9
 
 384 docbook: $(DOCBOOK_OUTPUT_FORMATS)
 
 386 xml: $(SOURCE_FILES_DBK)
 
 390 # we can generate PDFs from man pages
 
 392         $(MAKE) $(FILES_MANP)
 
 394 # we can generate plain text from man pages
 
 396         $(MAKE) $(FILES_MANT)
 
 408 # use the "debug" target to echo variables, etc., to
 
 409 # test/troubleshoot changes you make to this makefile
 
 411         echo $(wildcard *$(DOCBOOK_FILE_EXTENSION))
 
 412         echo $(ASCII_OR_DOCBOOK)
 
 413         echo $(SOURCE_FILES_DBK)
 
 415 # -----------------------------------------------------------------
 
 416 #     pattern rule to make DocBook refentry from asciidoc source
 
 417 # -----------------------------------------------------------------
 
 418 %.1$(DOCBOOK_FILE_EXTENSION): %.1.txt
 
 419         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 421 %.2$(DOCBOOK_FILE_EXTENSION): %.2.txt
 
 422         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 424 %.3$(DOCBOOK_FILE_EXTENSION): %.3.txt
 
 425         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 427 %.4$(DOCBOOK_FILE_EXTENSION): %.4.txt
 
 428         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 430 %.5$(DOCBOOK_FILE_EXTENSION): %.5.txt
 
 431         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 433 %.6$(DOCBOOK_FILE_EXTENSION): %.6.txt
 
 434         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 436 %.7$(DOCBOOK_FILE_EXTENSION): %.7.txt
 
 437         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 439 %.8$(DOCBOOK_FILE_EXTENSION): %.8.txt
 
 440         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 442 %.9$(DOCBOOK_FILE_EXTENSION): %.9.txt
 
 443         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
 
 445 # -----------------------------------------------------------------
 
 446 #     pattern rule to make DocBook article from asciidoc source
 
 447 # -----------------------------------------------------------------
 
 448 %$(DOCBOOK_FILE_EXTENSION): %.txt
 
 449         export LINECOUNT1=$$(cat $< | $(DOS2UNIX) $(DOS2UNIXFLAGS) | egrep "^=+$$" | wc -l); \
 
 450         export LINECOUNT2=$$(cat $< | $(DOS2UNIX) $(DOS2UNIXFLAGS) | egrep "^= $$" | wc -l); \
 
 451         if [[ $$LINECOUNT1 > 1 || $$LINECOUNT2 > 1 ]]; then \
 
 452         $(ASCIIDOC) $(ASCIIDOCFLAGS) -d book -b docbook $<; \
 
 454         $(ASCIIDOC) $(ASCIIDOCFLAGS) -b docbook $<; \
 
 457 # -----------------------------------------------------------------
 
 458 #     pattern rule for making (X)HTML and plain-text output
 
 459 # -----------------------------------------------------------------
 
 460 %.html: %$(DOCBOOK_FILE_EXTENSION)
 
 461         @echo '$(HTML_CUSTOM)' | $(XSLT) $(XSLT_FLAGS) $(HTML_PARAMS) - $< > $@
 
 464         $(TXT_MAKER) $(TXT_MAKER_FLAGS) ./$< \
 
 465           | sed "s/^\(\s\+[0-9]\+\. \)file:\/\/.\+$$/\\1(local)/g" \
 
 466           | egrep -v '^ file:///.+$$' \
 
 468 # if DOCBOOK_OUTPUT_FORMATS does not contain "html", then we need
 
 469 # to remove the "intermediate" HTML files we used for generating
 
 471 ifeq ($(findstring html,$(DOCBOOK_OUTPUT_FORMATS)),)
 
 475 # -----------------------------------------------------------------
 
 476 #     pattern rule for making chunked (X)HTML pages
 
 477 # -----------------------------------------------------------------
 
 478 %.$(HTML_MANIFEST_EXT): %$(DOCBOOK_FILE_EXTENSION)
 
 479         @echo '$(CHNK_CUSTOM)' | $(XSLT) $(XSLT_FLAGS) $(HTML_PARAMS) \
 
 480         --stringparam manifest $@  \
 
 481         --stringparam base.dir $(basename $@)$(BASEDIR_SUFFIX)/  \
 
 484 # -----------------------------------------------------------------
 
 485 #     pattern rules for making FO and PDF stuff
 
 486 # -----------------------------------------------------------------
 
 487 %.fo: %$(DOCBOOK_FILE_EXTENSION)
 
 488         @echo '$(FO_CUSTOM)' \
 
 489           | $(XSLT) $(XSLT_FLAGS) $(FO_PARAMS) - $< > $@
 
 491 ifeq ($(PDF_MAKER),dblatex)
 
 492 %.pdf: %$(DOCBOOK_FILE_EXTENSION)
 
 493         mkdir -p $(DOCBOOK_TMP)
 
 494         echo '$(DBX_CUSTOM)' > $(DOCBOOK_TMP)/dblatex.xsl
 
 495         -$(DBLATEX) $(DBLATEX_FLAGS)\
 
 496           -p $(DOCBOOK_TMP)/dblatex.xsl \
 
 499         $(RM) -r $(DOCBOOK_TMP)
 
 504         $(error No PDF_MAKER specified. Cannot make pdf)
 
 506 ifeq ($(PDF_MAKER),xep)
 
 507         $(XEP) $(XEP_FLAGS) $< $@
 
 509 ifeq ($(PDF_MAKER),fop)
 
 510         $(FOP) $(FOP_FLAGS) $< $@
 
 512 ifeq ($(PDF_MAKER),xmlroff)
 
 513         $(XMLROFF) $(XMLROFF_FLAGS) $< -o $@
 
 515 ifeq ($(PDF_MAKER),passivetex)
 
 516         $(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $<
 
 517         @if [ `egrep Rerun $(basename $@).log | wc -l` -gt 0 ]; then \
 
 518                 $(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $< ; \
 
 520         @if [ `egrep Rerun $(basename $@).log | wc -l` -gt 0 ]; then \
 
 521                 $(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $< ; \
 
 523         $(RM) $(basename $@).log
 
 524         $(RM) $(basename $@).aux
 
 525         $(RM) $(basename $@).out
 
 527         $(error I do not know how to make a PDF using "$(PDF_MAKER)")
 
 534 # -----------------------------------------------------------------
 
 535 #     pattern rules for making TeXinfo stuff
 
 536 # -----------------------------------------------------------------
 
 537 %.txml: %$(DOCBOOK_FILE_EXTENSION)
 
 538         $(DB2X_XSLTPROC) $(DB2X_XSLTPROC_FLAGS) -s texi -o $@ $<
 
 541         $(DB2X_TEXIXML) $(DB2X_TEXIXML_FLAGS) $<
 
 543 # the following is actually a built-in rule, but it's redefined
 
 544 # here just for the sake of clarity
 
 546         $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@
 
 548 # -----------------------------------------------------------------
 
 549 #     pattern rule for making man pages
 
 550 # -----------------------------------------------------------------
 
 551 %.$(MAN_MANIFEST_EXT): %$(DOCBOOK_FILE_EXTENSION)
 
 552         @if [ "$(strip $(shell echo '$(REFENTRY_CHECK)' | $(XSLT) $(XSLT_FLAGS) - $<))" != "true" ]; then \
 
 555           echo '$(MAN_CUSTOM)' \
 
 556           | $(XSLT) $(XSLT_FLAGS) $(MAN_PARAMS) \
 
 557             --stringparam man.output.manifest.filename $@ \
 
 561 # -----------------------------------------------------------------
 
 562 #  pattern rule for enabling direct "make foo.1" to work
 
 563 # -----------------------------------------------------------------
 
 565 %.1 %.2 %.3 %.4 %.5 %.6 %.7: %.xml
 
 566         $(MAKE) $(basename $<).$(MAN_MANIFEST_EXT)
 
 568 # -----------------------------------------------------------------
 
 569 #  pattern rules for making Postscript/PDF output from man pages
 
 570 # -----------------------------------------------------------------
 
 572         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 575         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 578         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 581         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 584         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 587         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 590         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 593         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 596         $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
 
 598 # -----------------------------------------------------------------
 
 599 #  pattern rule for converting Postscript to PDF
 
 600 # -----------------------------------------------------------------
 
 602         $(PS2PDF) $(PS2PDF_FLAGS) $<
 
 604 # -----------------------------------------------------------------
 
 605 #  pattern rules for making plain-text output from man pages
 
 606 # -----------------------------------------------------------------
 
 608         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 611         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 614         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 617         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 620         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 623         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 626         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 629         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 632         $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
 
 634 # -----------------------------------------------------------------
 
 635 #   target(s) for cleaning up the mess
 
 636 # -----------------------------------------------------------------
 
 638 ifneq ($(FILES_TXT),)
 
 641 ifneq ($(FILES_PDF),)
 
 647 ifneq ($(FILES_LOG),)
 
 650 ifneq ($(FILES_OUT),)
 
 653 ifneq ($(FILES_AUX),)
 
 656 ifneq ($(FILES_HTML),)
 
 659 ifneq ($(FILES_CHNK),)
 
 662 ifneq ($(FILES_MAN),)
 
 665 ifneq ($(FILES_MANT),)
 
 668 ifneq ($(FILES_MANP),)
 
 671 ifneq ($(FILES_INFO),)
 
 674 ifneq ($(DIRS_CHUNK),)
 
 675         for dir in $(DIRS_CHUNK); do \
 
 676           if [ -d "$$dir" ]; then \
 
 677             $(RMDIR) $(RMDIR_FLAGS) $$dir; \
 
 682 ifneq ($(DIRS_MAN),.)
 
 683         for dir in $(DIRS_MAN); do \
 
 684           if [ -d "$$dir" ]; then \
 
 685             $(RMDIR) $(RMDIR_FLAGS) $$dir; \
 
 690 ifneq ($(LISTS_MAN),)
 
 693 ifneq ($(LISTS_HTML),)
 
 696 ifneq ($(ASCII_OR_DOCBOOK),docbook)
 
 697         $(RM) -i $(SOURCE_FILES_DBK)