1# $Source: /cvsroot/docbook/xsl/tools/make/Makefile.DocBook,v $
2# $Author: xmldoc $
3# $Date: 2006/04/25 06:31:24 $
4# $Revision: 1.4 $
5# vim: number
6#
7# -----------------------------------------------------------------
8#  ** Makefile.DocBook -- generate output from DocBook sources **
9# -----------------------------------------------------------------
10#
11#   This file is part of the DocBook Project XSL Stylesheet
12#   distribution.
13#
14#   See http://docbook.sourceforge.net/release/xsl/current/
15#   for copyright and other information.
16
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:
22#
23#   set DOCBOOK_OUTPUT_FORMATS="html pdf"; export DOCBOOK_OUTPUT_FORMATS
24#
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:
28#
29#   make html txt
30#
31# That would generate just HTML (unchunked) and plain-text output.
32#
33DOCBOOK_OUTPUT_FORMATS ?= man chunk txt pdf
34
35# -----------------------------------------------------------------
36#                *** TOOLS and other DEPENDENCIES ***
37# -----------------------------------------------------------------
38# we use rmdir(1) to remove dirs we create for chunked HTML output
39RMDIR = rmdir
40# "-p" causes empty parent dirs to be deleted as well
41RMDIR_FLAGS = --ignore-fail-on-non-empty -p
42
43# possible values for PDF_MAKER are:
44#   dblatex|fop|xep|xmlroff|passivetex
45PDF_MAKER = fop
46
47# possible values for TXT_MAKER are:
48#   links|lynx|w3m|w3mmee
49TXT_MAKER = links
50TXT_MAKER_FLAGS = -dump
51
52# xsl
53XSLT = xsltproc
54XSLT_FLAGS = --xinclude
55
56# http://dblatex.sourceforge.net/
57DBLATEX = dblatex
58DBLATEX_FLAGS = -b pdftex
59
60FOP = fop
61FOP_FLAGS =
62
63XEP = xep
64XEP_FLAGS =
65
66# http://xmlroff.sourceforge.net/
67XMLROFF = xmlroff
68XMLROFF_FLAGS =
69
70PDFTEX = pdftex
71PDFTEX_FLAGS =
72
73# used by PassiveTeX
74PDFXMLTEX = pdfxmltex
75
76# http://docbook2x.sourceforge.net/
77DB2X_XSLTPROC = db2x_xsltproc
78DB2X_XSLTPROC_FLAGS = 
79DB2X_TEXIXML = db2x_texixml
80DB2X_TEXIXML_FLAGS = 
81
82# we call the man(1) command to generate "foo.N.pdf" and
83# "foo.N.txt" output (see "man-pdf" & "man-txt" targets)
84MAN = man
85MAN_FLAGS =
86
87# The "ps2pdf" command is part of GhostSript (gs) distro.
88# It is just a wrapper script around gs that does this:
89#
90#   gs -dCompatibilityLevel=1.2 -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
91#     "-sOutputFile=$outfile" -dCompatibilityLevel=1.2 -c .setpdfwrite -f "$infile"
92#
93# Where, for example: $outfile = foo.pdf and $infile = foo.1
94PS2PDF = ps2pdf
95PS2PDF_FLAGS =
96
97# The "col" command is needed for stripping backspaces and
98# underscores from man(1) output to get pure plain-text
99COL = col
100COL_FLAGS =
101
102# The "expand" command is needed for expanding tabs from files
103# generated from "man foo.1 | col -b" output
104# output to get pure plain-text
105EXPAND = expand
106EXPAND_FLAGS =
107
108# value of DOCBOOK_XSL should either be the canonical
109# (docbook.sourceforge.net) URL for the DocBook Project XSL
110# stylesheets OR it can be a local system path
111DOCBOOK_XSL = http://docbook.sourceforge.net/release/xsl/current
112
113# -----------------------------------------------------------------
114#       names of some DIRECTORIES and FILES we need
115# -----------------------------------------------------------------
116# We create a tmp directory once per make invocation; it's needed
117# for holding a temporary copy of the custom DBLaTeX stylesheet
118# (because dblatex currently can't read a stylesheet from stdin)
119TMP ?= /tmp
120TMPNUM := $(shell echo $$$$)
121DOCBOOK_TMP := $(TMP)/docbook-make-$(TMPNUM)
122
123# MAN_MANIFEST_EXT is file extension added to individual manifest
124# files
125MAN_MANIFEST_EXT = manifest_man
126
127# HTML_MANIFEST_EXT is file extension added to HTML manifest files
128HTML_MANIFEST_EXT = manifest_html
129
130# BASEDIR_SUFFIX is a what you need to set if you want a suffix
131# added to the end of each "base.dir" we create while generating
132# chunked HTML output
133#BASEDIR_SUFFIX = -html
134#BASEDIR_SUFFIX = _html
135BASEDIR_SUFFIX = 
136
137# -----------------------------------------------------------------
138#                        assorted OPTIONS
139# -----------------------------------------------------------------
140# HTML_STYLESHEET -> $html.stylesheet stylesheet param
141# http://docbook.sourceforge.net/snapshots/xsl/doc/html/html.stylesheet.html
142HTML_STYLESHEET = style.css
143# HTML_IMAGES -> $admon.graphics.path
144# http://docbook.sourceforge.net/snapshots/xsl/doc/html/admon.graphics.path.html
145HTML_IMAGES = images/
146# HTML_IMAGES_EXT -> $admon.graphics.extension
147# http://docbook.sourceforge.net/snapshots/xsl/doc/html/admon.graphics.extension.html
148HTML_IMAGES_EXT = .png
149
150# use these to set params on the command-line
151# format is, e.g., HTML_PARAMS="--stringparam variablelist.as.table 1..."
152FO_PARAMS =
153HTML_PARAMS =
154MAN_PARAMS =
155
156# DBX_PARAMS is for dblatex(1); format uses "-p":
157# DBX_PARAMS="-p doc.publisher.show 1 -p term.breakline 1...
158DBX_PARAMS=
159
160# What file extension do you use for DocBook source files?
161DOCBOOK_FILE_EXTENSION = .xml
162
163# -----------------------------------------------------------------
164#       make(1) functions for building file lists
165# -----------------------------------------------------------------
166#
167#    the values of the following are used for determing what needs
168#    to be built and/or cleaned up
169
170SOURCE_FILES_DBK = $(wildcard *$(DOCBOOK_FILE_EXTENSION))
171
172FILES_FO   = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).fo)
173FILES_TXT  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).txt)
174FILES_PDF  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).pdf)
175FILES_LOG  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).log)
176FILES_OUT  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).out)
177FILES_AUX  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).aux)
178FILES_HTML = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).html)
179FILES_INFO = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).info)
180DIRS_CHUNK = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base)$(BASEDIR_SUFFIX))
181LISTS_HTML = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).$(HTML_MANIFEST_EXT))
182LISTS_MAN  = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).$(MAN_MANIFEST_EXT))
183FILES_CHNK = $(shell for manifest in $(LISTS_HTML); do if [ -f "$$manifest" ]; then cat $$manifest; fi done)
184FILES_MAN  = $(shell for manifest in $(LISTS_MAN);  do if [ -f "$$manifest" ]; then cat $$manifest; fi done)
185FILES_MANP = $(foreach base,$(FILES_MAN),$(base).pdf)
186FILES_MANT = $(foreach base,$(FILES_MAN),$(base).txt)
187DIRS_MAN   = $(shell for file in $(FILES_MAN); do dirname $$file; done | uniq)
188
189# -----------------------------------------------------------------
190#   ** stylesheet for testing whether a file has a refentry
191# -----------------------------------------------------------------
192REFENTRY_CHECK := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
193                version="1.0" \
194                xmlns:db="http://docbook.org/ns/docbook" \
195                > \
196  <xsl:output method="text"/> \
197  <xsl:template match="/"> \
198    <xsl:if test="//refentry|//db:refentry"> \
199      <xsl:text>true</xsl:text> \
200    </xsl:if> \
201  </xsl:template> \
202</xsl:stylesheet>
203
204# -----------------------------------------------------------------
205#             ** Stylesheet Customization Layers ** 
206# -----------------------------------------------------------------
207#
208# for DBLaTeX
209DBX_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
210                 version="1.0"> \
211  <xsl:param name="co.linkends.show">0</xsl:param> \
212  <xsl:param name="callout.markup.circled">1</xsl:param> \
213  <xsl:param name="callout.linkends.hot">0</xsl:param> \
214  <xsl:param name="doc.publisher.show">1</xsl:param> \
215  <xsl:param name="term.breakline">1</xsl:param> \
216  <xsl:param name="doc.alignment">left</xsl:param> \
217  <xsl:param name="newtbl.use">1</xsl:param> \
218  <xsl:param name="latex.hyperparam"/> \
219  <xsl:param name="latex.style">docbook</xsl:param> \
220  <xsl:param name="latex.biblio.output">all</xsl:param> \
221  <xsl:param name="latex.bibfiles">""</xsl:param> \
222  <xsl:param name="latex.bibwidelabel">WIDELABEL</xsl:param> \
223  <xsl:param name="latex.output.revhistory">0</xsl:param> \
224  <xsl:param name="latex.figure.position">[htbp]</xsl:param> \
225  <xsl:param name="latex.figure.boxed">0</xsl:param> \
226  <xsl:param name="latex.babel.use">1</xsl:param> \
227  <xsl:param name="latex.babel.language"></xsl:param> \
228  <xsl:param name="latex.class.options">twoside</xsl:param> \
229  <xsl:param name="biblioentry.item.separator">, </xsl:param> \
230  <xsl:param name="refentry.xref.manvolnum">1</xsl:param> \
231  <xsl:param name="refsynopsis.title">Synopsis</xsl:param> \
232  <xsl:param name="refnamediv.title"></xsl:param> \
233  <xsl:param name="funcsynopsis.style">ansi</xsl:param> \
234  <xsl:param name="funcsynopsis.decoration">1</xsl:param> \
235  <xsl:param name="function.parens">0</xsl:param> \
236  <xsl:param name="classsynopsis.default.language">java</xsl:param> \
237  <xsl:param name="show.comments">0</xsl:param> \
238</xsl:stylesheet>
239
240# for FO output
241FO_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
242                xmlns:fo="http://www.w3.org/1999/XSL/Format" \
243                version="1.0"> \
244  <xsl:import href="$(DOCBOOK_XSL)/fo/docbook.xsl"/> \
245  <xsl:param name="$(PDF_MAKER).extensions">1</xsl:param> \
246  <xsl:param name="paper.type">A4</xsl:param> \
247  <xsl:param name="draft.watermark.image"></xsl:param> \
248  <xsl:param name="hyphenation">false</xsl:param> \
249  <xsl:param name="alignment">left</xsl:param> \
250  <xsl:param name="refentry.generate.name">1</xsl:param> \
251  <xsl:param name="refentry.generate.title">0</xsl:param> \
252  <xsl:param name="refentry.pagebreak">1</xsl:param> \
253  <xsl:param name="shade.verbatim">1</xsl:param> \
254  <xsl:param name="variablelist.as.blocks">1</xsl:param> \
255  <xsl:param name="ulink.show">1</xsl:param> \
256  <xsl:param name="ulink.footnotes">1</xsl:param> \
257  <xsl:param name="index.on.type">1</xsl:param> \
258  <xsl:attribute-set name="xref.properties"> \
259    <xsl:attribute name="color">blue</xsl:attribute> \
260  </xsl:attribute-set> \
261  <xsl:attribute-set name="shade.verbatim.style"> \
262    <xsl:attribute name="background-color">\#E0E0E0</xsl:attribute> \
263    <xsl:attribute name="padding-left">4pt</xsl:attribute> \
264    <xsl:attribute name="padding-right">4pt</xsl:attribute> \
265    <xsl:attribute name="padding-top">4pt</xsl:attribute> \
266    <xsl:attribute name="padding-bottom">4pt</xsl:attribute> \
267  </xsl:attribute-set> \
268  <xsl:attribute-set name="section.title.level1.properties"> \
269    <xsl:attribute name="font-size"> \
270      <xsl:value-of select="$$body.font.master * 1.728"></xsl:value-of> \
271      <xsl:text>pt</xsl:text> \
272    </xsl:attribute> \
273  </xsl:attribute-set> \
274  <xsl:attribute-set name="section.title.level2.properties"> \
275    <xsl:attribute name="font-size"> \
276      <xsl:value-of select="$$body.font.master * 1.44"></xsl:value-of> \
277      <xsl:text>pt</xsl:text> \
278    </xsl:attribute> \
279  </xsl:attribute-set> \
280  <xsl:attribute-set name="section.title.level3.properties"> \
281    <xsl:attribute name="font-size"> \
282      <xsl:value-of select="$$body.font.master * 1.2"></xsl:value-of> \
283      <xsl:text>pt</xsl:text> \
284    </xsl:attribute> \
285  </xsl:attribute-set> \
286  <xsl:attribute-set name="section.title.level4.properties"> \
287    <xsl:attribute name="font-size"> \
288      <xsl:value-of select="$$body.font.master"></xsl:value-of> \
289      <xsl:text>pt</xsl:text> \
290    </xsl:attribute> \
291  </xsl:attribute-set> \
292  <xsl:attribute-set name="component.title.properties"> \
293    <xsl:attribute name="font-size"> \
294      <xsl:value-of select="$$body.font.master * 1.728"></xsl:value-of> \
295      <xsl:text>pt</xsl:text> \
296    </xsl:attribute> \
297  </xsl:attribute-set> \
298  <xsl:attribute-set name="monospace.verbatim.properties"> \
299    <xsl:attribute name="font-size"> \
300      <xsl:value-of select="$$body.font.master * 0.8"></xsl:value-of> \
301      <xsl:text>pt</xsl:text> \
302    </xsl:attribute> \
303  </xsl:attribute-set> \
304</xsl:stylesheet>
305
306# for single-file HTML outpout
307HTML_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
308                version="1.0"> \
309  <xsl:import href="$(DOCBOOK_XSL)/html/docbook.xsl"/> \
310  <xsl:param name="gentext.custom">local.l10n.xml</xsl:param> \
311  <xsl:param name="local.l10n.xml" select="document($$gentext.custom)"/> \
312  <xsl:param name="refentry.generate.name">1</xsl:param> \
313  <xsl:param name="refentry.generate.title">0</xsl:param> \
314  <xsl:param name="root.filename"></xsl:param> \
315  <xsl:param name="variablelist.as.table">0</xsl:param> \
316  <xsl:param name="html.stylesheet">$(HTML_STYLESHEET)</xsl:param> \
317  <xsl:param name="admon.graphics">0</xsl:param> \
318  <xsl:param name="index.on.type">1</xsl:param> \
319</xsl:stylesheet>
320
321# for chunked HTML output
322CHNK_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
323                version="1.0"> \
324  <xsl:import href="$(DOCBOOK_XSL)/html/chunk.xsl"/> \
325  <xsl:param name="refentry.generate.name">0</xsl:param> \
326  <xsl:param name="refentry.generate.title">1</xsl:param> \
327  <xsl:param name="variablelist.as.table">0</xsl:param> \
328  <xsl:param name="html.stylesheet">$(HTML_STYLESHEET)</xsl:param> \
329  <xsl:param name="admon.graphics">1</xsl:param> \
330  <xsl:param name="admon.graphics.path">$(HTML_IMAGES)</xsl:param> \
331  <xsl:param name="admon.graphics.extension">$(HTML_IMAGES_EXT)</xsl:param> \
332  <xsl:param name="root.filename"></xsl:param> \
333  <xsl:param name="generate.manifest">1</xsl:param> \
334  <xsl:param name="use.id.as.filename">1</xsl:param> \
335  <xsl:param name="chunker.output.indent">yes</xsl:param> \
336  <xsl:param name="index.on.type">1</xsl:param> \
337</xsl:stylesheet>
338
339# for man-page output
340MAN_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
341                version="1.0"> \
342  <xsl:import href="$(DOCBOOK_XSL)/manpages/docbook.xsl"/> \
343  <xsl:param name="man.output.manifest.enabled" select="1"/> \
344  <xsl:param name="man.output.in.separate.dir" select="1"/> \
345  <xsl:param name="man.output.base.dir">man/</xsl:param> \
346  <xsl:param name="man.output.subdirs.enabled" select="1"/> \
347</xsl:stylesheet>
348
349# -----------------------------------------------------------------
350#                  ** TARGETS START HERE ** 
351# -----------------------------------------------------------------
352#  prevents make from deleting, e.g. foo.1, after making foo.1.pdf
353#  and foo.1.txt from it.
354.PRECIOUS: %.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9
355
356docbook: $(DOCBOOK_OUTPUT_FORMATS)
357
358man: $(LISTS_MAN)
359
360# we can generate PDFs from man pages
361man-pdf: man
362	$(MAKE) $(FILES_MANP)
363
364# we can generate plain text from man pages
365man-txt: man
366	$(MAKE) $(FILES_MANT)
367
368html: $(FILES_HTML)
369
370chunk: $(LISTS_HTML)
371
372txt: $(FILES_TXT)
373
374pdf: $(FILES_PDF)
375
376info: $(FILES_INFO)
377
378# use the "debug" target to echo variables, etc., to
379# test/troubleshoot changes you make to this makefile
380debug:
381	@echo $(DIRS_MAN)
382
383# -----------------------------------------------------------------
384#     pattern rule for making HTML and plain-text output
385# -----------------------------------------------------------------
386%.html: %.xml
387	@echo '$(HTML_CUSTOM)' | $(XSLT) $(XSLT_FLAGS) $(HTML_PARAMS) - $< > $@
388
389%.txt: %.html
390	$(TXT_MAKER) $(TXT_MAKER_FLAGS) ./$< \
391	  | sed "s/^\(\s\+[0-9]\+\. \)file:\/\/.\+$$/\\1(local)/g" \
392	  | egrep -v '^	file:///.+$$' \
393	  > $@
394# if DOCBOOK_OUTPUT_FORMATS does not contain "html", then we need
395# to remove the "intermediate" HTML files we used for generating
396# plain-text output
397ifeq ($(findstring html,$(DOCBOOK_OUTPUT_FORMATS)),)
398	$(RM) $<
399endif
400
401# -----------------------------------------------------------------
402#     pattern rule for making chunked HTML pages
403# -----------------------------------------------------------------
404%.$(HTML_MANIFEST_EXT): %.xml
405	@echo '$(CHNK_CUSTOM)' | $(XSLT) $(XSLT_FLAGS) $(HTML_PARAMS) \
406	--stringparam manifest $@  \
407	--stringparam base.dir $(basename $@)$(BASEDIR_SUFFIX)/  \
408	- $< 
409
410# -----------------------------------------------------------------
411#     pattern rules for making FO and PDF stuff
412# -----------------------------------------------------------------
413%.fo: %.xml
414	@echo '$(FO_CUSTOM)' \
415	  | $(XSLT) $(XSLT_FLAGS) $(FO_PARAMS) - $< > $@
416
417ifeq ($(PDF_MAKER),dblatex)
418%.pdf: %.xml
419	mkdir -p $(DOCBOOK_TMP)
420	echo '$(DBX_CUSTOM)' > $(DOCBOOK_TMP)/dblatex.xsl
421	-$(DBLATEX) $(DBLATEX_FLAGS)\
422	  -p $(DOCBOOK_TMP)/dblatex.xsl \
423	  -o $@ \
424	  $<
425	$(RM) -r $(DOCBOOK_TMP)
426endif
427
428%.pdf: %.fo
429ifeq ($(PDF_MAKER),)
430	$(error No PDF_MAKER specified. Cannot make pdf)
431else
432ifeq ($(PDF_MAKER),xep)
433	$(XEP) $(XEP_FLAGS) $< $@
434else
435ifeq ($(PDF_MAKER),fop)
436	$(FOP) $(FOP_FLAGS) $< $@
437else
438ifeq ($(PDF_MAKER),xmlroff)
439	$(XMLROFF) $(XMLROFF_FLAGS) $< -o $@
440else
441ifeq ($(PDF_MAKER),passivetex)
442	$(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $<
443	@if [ `egrep Rerun $(basename $@).log | wc -l` -gt 0 ]; then \
444		$(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $< ; \
445	fi
446	@if [ `egrep Rerun $(basename $@).log | wc -l` -gt 0 ]; then \
447		$(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $< ; \
448	fi
449	$(RM) $(basename $@).log
450	$(RM) $(basename $@).aux
451	$(RM) $(basename $@).out
452else
453	$(error I do not know how to make a PDF using "$(PDF_MAKER)")
454endif
455endif
456endif
457endif
458endif
459
460# -----------------------------------------------------------------
461#     pattern rules for making TeXinfo stuff
462# -----------------------------------------------------------------
463%.txml: %.xml
464	$(DB2X_XSLTPROC) $(DB2X_XSLTPROC_FLAGS) -s texi -o $@ $<
465
466%.texi: %.txml
467	$(DB2X_TEXIXML) $(DB2X_TEXIXML_FLAGS) $<
468
469# the following is actually a built-in rule, but it's redefined
470# here just for the sake of clarity
471%.info: %.texi
472	$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@
473
474# -----------------------------------------------------------------
475#     pattern rule for making man pages
476# -----------------------------------------------------------------
477%.$(MAN_MANIFEST_EXT): %.xml
478	@if [ "$(strip $(shell echo '$(REFENTRY_CHECK)' | $(XSLT) $(XSLT_FLAGS) - $<))" != "true" ]; then \
479	  touch $@; \
480	else \
481	  echo '$(MAN_CUSTOM)' \
482	  | $(XSLT) $(XSLT_FLAGS) $(MAN_PARAMS) \
483	    --stringparam man.output.manifest.filename $@ \
484	    - $<; \
485	fi
486
487# -----------------------------------------------------------------
488#  pattern rule for enabling direct "make foo.1" to work
489# -----------------------------------------------------------------
490
491%.1 %.2 %.3 %.4 %.5 %.6 %.7: %.xml
492	$(MAKE) $(basename $<).$(MAN_MANIFEST_EXT)
493
494# -----------------------------------------------------------------
495#  pattern rules for making Postscript/PDF output from man pages
496# -----------------------------------------------------------------
497%.1.ps: %.1
498	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
499
500%.2.ps: %.2
501	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
502
503%.3.ps: %.3
504	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
505
506%.4.ps: %.4
507	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
508
509%.5.ps: %.5
510	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
511
512%.6.ps: %.6
513	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
514
515%.7.ps: %.7
516	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
517
518%.8.ps: %.8
519	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
520
521%.9.ps: %.9
522	$(MAN) -l $(MAN_FLAGS) -Tps $< > $@
523
524# -----------------------------------------------------------------
525#  pattern rule for converting Postscript to PDF
526# -----------------------------------------------------------------
527%.pdf: %.ps
528	$(PS2PDF) $(PS2PDF_FLAGS) $<
529
530# -----------------------------------------------------------------
531#  pattern rules for making plain-text output from man pages
532# -----------------------------------------------------------------
533%.1.txt: %.1
534	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
535
536%.2.txt: %.2
537	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
538
539%.3.txt: %.3
540	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
541
542%.4.txt: %.4
543	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
544
545%.5.txt: %.5
546	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
547
548%.6.txt: %.6
549	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
550
551%.7.txt: %.7
552	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
553
554%.8.txt: %.8
555	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
556
557%.9.txt: %.9
558	$(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
559
560# -----------------------------------------------------------------
561#   target(s) for cleaning up the mess
562# -----------------------------------------------------------------
563clean:
564ifneq ($(FILES_TXT),)
565	$(RM) $(FILES_TXT)
566endif
567ifneq ($(FILES_PDF),)
568	$(RM) $(FILES_PDF)
569endif
570ifneq ($(FILES_FO),)
571	$(RM) $(FILES_FO)
572endif
573ifneq ($(FILES_LOG),)
574	$(RM) $(FILES_LOG)
575endif
576ifneq ($(FILES_OUT),)
577	$(RM) $(FILES_OUT)
578endif
579ifneq ($(FILES_AUX),)
580	$(RM) $(FILES_AUX)
581endif
582ifneq ($(FILES_HTML),)
583	$(RM) $(FILES_HTML)
584endif
585ifneq ($(FILES_CHNK),)
586	$(RM) $(FILES_CHNK)
587endif
588ifneq ($(FILES_MAN),)
589	$(RM) $(FILES_MAN)
590endif
591ifneq ($(FILES_MANT),)
592	$(RM) $(FILES_MANT)
593endif
594ifneq ($(FILES_MANP),)
595	$(RM) $(FILES_MANP)
596endif
597ifneq ($(FILES_INFO),)
598	$(RM) $(FILES_INFO)
599endif
600ifneq ($(DIRS_CHUNK),)
601	for dir in $(DIRS_CHUNK); do \
602	  if [ -d "$$dir" ]; then \
603	    $(RMDIR) $(RMDIR_FLAGS) $$dir; \
604	  fi \
605	done
606endif
607ifneq ($(DIRS_MAN),)
608	for dir in $(DIRS_MAN); do \
609	  if [ -d "$$dir" ]; then \
610	    $(RMDIR) $(RMDIR_FLAGS) $$dir; \
611	  fi \
612	done
613endif
614ifneq ($(LISTS_MAN),)
615	$(RM) $(LISTS_MAN)
616endif
617ifneq ($(LISTS_HTML),)
618	$(RM) $(LISTS_HTML)
619endif
620