Revised bootstrap to inject package variables from VERSION file.
[Ale.git] / doc / Makefile
blob714e8b28667c8cf755bc2206278f2edcb9558b83
2 # Makefile modified by David Hilvert to generate ALE documentation.
3 # 24-Sep-2006
6 # $Source$
7 # $Author: xmldoc $
8 # $Date: 2006-09-01 15:47:16 +0900 (Fri, 01 Sep 2006) $
9 # $Revision: 6235 $
10 # vim: number
12 # -----------------------------------------------------------------
13 # ** Makefile.DocBook -- generate output from DocBook sources **
14 # -----------------------------------------------------------------
16 # This file is part of the DocBook Project XSL Stylesheet
17 # distribution.
19 # See http://docbook.sourceforge.net/release/xsl/current/
20 # for copyright and other information.
22 # DOCBOOK_OUTPUT_FORMATS is the default set of targets (output
23 # formats) that get built when you type "make" without any targets
24 # explicitly specified. To generate a different set of output
25 # formats, change the value of DOCBOOK_OUTPUT_FORMATS here or set
26 # it in your environment; for example:
28 # set DOCBOOK_OUTPUT_FORMATS="html pdf"; export DOCBOOK_OUTPUT_FORMATS
30 # Of course by explicitly specifying particular targets when you
31 # invoke "make", you can always override generation of the default
32 # set of targets; for example:
34 # make html txt
36 # That would generate just HTML (unchunked) and plain-text output.
38 DOCBOOK_OUTPUT_FORMATS ?= man chunk txt pdf info
40 # If you want XHTML output instead of HTML, set HTML_OR_XHTML to
41 # 'xhtml' or just specify 'xhtml" in DOCBOOK_OUTPUT_FORMATS.
42 ifeq ($(findstring xhtml,$(DOCBOOK_OUTPUT_FORMATS)),)
43 HTML_OR_XHTML ?= html
44 else
45 HTML_OR_XHTML ?= xhtml
46 endif
48 # -----------------------------------------------------------------
49 # *** TOOLS and other DEPENDENCIES ***
50 # -----------------------------------------------------------------
51 # we use rmdir(1) to remove dirs we create for chunked HTML output
52 RMDIR = rmdir
53 # "-p" causes empty parent dirs to be deleted as well
54 RMDIR_FLAGS = --ignore-fail-on-non-empty -p
56 # possible values for PDF_MAKER are:
57 # dblatex|fop|xep|xmlroff|passivetex
58 PDF_MAKER = fop
60 # possible values for TXT_MAKER are:
61 # links|lynx|w3m|w3mmee
62 TXT_MAKER = links
63 # TXT_MAKER_FLAGS = -dump -no-numbering -no-references
64 TXT_MAKER_FLAGS = -dump
66 # xsl
67 XSLT = xsltproc
68 XSLT_FLAGS = --xinclude $(XSLT_VERSION_INFO)
70 # http://dblatex.sourceforge.net/
71 DBLATEX = dblatex
72 DBLATEX_FLAGS = -b pdftex -P page.margin.inner=0.8 -P page.margin.outer=0.5 -P double.sided=1 -T db2latex
74 FOP = fop
75 FOP_FLAGS =
77 XEP = xep
78 XEP_FLAGS =
80 # http://xmlroff.sourceforge.net/
81 XMLROFF = xmlroff
82 XMLROFF_FLAGS =
84 PDFTEX = pdftex
85 PDFTEX_FLAGS =
87 # used by PassiveTeX
88 PDFXMLTEX = pdfxmltex
90 # http://docbook2x.sourceforge.net/
91 DB2X_XSLTPROC = db2x_xsltproc
92 DB2X_XSLTPROC_FLAGS = --xinclude
93 DB2X_TEXIXML = db2x_texixml --list-files
94 DB2X_TEXIXML_FLAGS =
96 # we call the man(1) command to generate "foo.N.pdf" and
97 # "foo.N.txt" output (see "man-pdf" & "man-txt" targets)
98 MAN = man
99 MAN_FLAGS =
101 # The "ps2pdf" command is part of GhostSript (gs) distro.
102 # It is just a wrapper script around gs that does this:
104 # gs -dCompatibilityLevel=1.2 -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
105 # "-sOutputFile=$outfile" -dCompatibilityLevel=1.2 -c .setpdfwrite -f "$infile"
107 # Where, for example: $outfile = foo.pdf and $infile = foo.1
108 PS2PDF = ps2pdf
109 PS2PDF_FLAGS =
111 # The "col" command is needed for stripping backspaces and
112 # underscores from man(1) output to get pure plain-text
113 COL = col
114 COL_FLAGS =
116 # The "expand" command is needed for expanding tabs from files
117 # generated from "man foo.1 | col -b" output
118 # output to get pure plain-text
119 EXPAND = expand
120 EXPAND_FLAGS =
122 # value of DOCBOOK_XSL should either be the canonical
123 # (docbook.sourceforge.net) URL for the DocBook Project XSL
124 # stylesheets OR it can be a local system path
125 DOCBOOK_XSL = http://docbook.sourceforge.net/release/xsl/current
127 # -----------------------------------------------------------------
128 # names of some DIRECTORIES and FILES we need
129 # -----------------------------------------------------------------
130 # We create a tmp directory once per make invocation; it's needed
131 # for holding a temporary copy of the custom DBLaTeX stylesheet
132 # (because dblatex currently can't read a stylesheet from stdin)
133 TMP ?= /tmp
134 TMPNUM := $(shell echo $$$$)
135 DOCBOOK_TMP := $(TMP)/docbook-make-$(TMPNUM)
137 # MAN_MANIFEST_EXT is file extension added to individual manifest
138 # files
139 MAN_MANIFEST_EXT = manifest_man
141 # HTML_MANIFEST_EXT is file extension added to HTML manifest files
142 HTML_MANIFEST_EXT = manifest_html
144 # BASEDIR_SUFFIX is a what you need to set if you want a suffix
145 # added to the end of each "base.dir" we create while generating
146 # chunked HTML output
147 #BASEDIR_SUFFIX = -html
148 #BASEDIR_SUFFIX = _html
149 BASEDIR_SUFFIX =
152 # Workaround the fact that we don't calculate dependencies.
155 BROKEN_DEPENDENCIES = package/changelog/index.in $(shell find . -name "*.xml") package/changelog/index.xml make-changelog Makefile
158 # -----------------------------------------------------------------
159 # assorted OPTIONS
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..."
173 FO_PARAMS =
174 HTML_PARAMS =
175 MAN_PARAMS =
177 # DBX_PARAMS is for dblatex(1); format uses "-p":
178 # DBX_PARAMS="-p doc.publisher.show 1 -p term.breakline 1...
179 DBX_PARAMS=
181 # What file extension do you use for DocBook source files?
182 DOCBOOK_FILE_EXTENSION = .docbook
183 SOURCE_FILE_EXTENSION = .xml
185 # -----------------------------------------------------------------
186 # make(1) functions for building file lists
187 # -----------------------------------------------------------------
189 # the values of the following are used for determing what needs
190 # to be built and/or cleaned up
192 SOURCE_FILES_DBK = $(wildcard *$(SOURCE_FILE_EXTENSION))
194 FILES_FO = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).fo)
195 FILES_TXT = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).txt)
196 FILES_PDF = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).pdf)
197 FILES_LOG = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).log)
198 FILES_OUT = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).out)
199 FILES_AUX = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).aux)
200 FILES_HTML = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).html)
201 FILES_INFO = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).info)
202 DIRS_CHUNK = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base)$(BASEDIR_SUFFIX))
203 LISTS_HTML = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).$(HTML_MANIFEST_EXT))
204 LISTS_MAN = $(foreach base,$(basename $(SOURCE_FILES_DBK)),$(base).$(MAN_MANIFEST_EXT))
205 FILES_CHNK = $(shell for manifest in $(LISTS_HTML); do if [ -f "$$manifest" ]; then cat $$manifest; fi done)
206 FILES_MAN = $(shell for manifest in $(LISTS_MAN); do if [ -f "$$manifest" ]; then cat $$manifest; fi done)
207 FILES_MANP = $(foreach base,$(FILES_MAN),$(base).pdf)
208 FILES_MANT = $(foreach base,$(FILES_MAN),$(base).txt)
209 DIRS_MAN = $(shell for file in $(FILES_MAN); do dirname $$file; done | uniq)
211 # -----------------------------------------------------------------
212 # ** stylesheet for testing whether a file has a refentry
213 # -----------------------------------------------------------------
214 REFENTRY_CHECK := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
215 version="1.0" \
216 xmlns:db="http://docbook.org/ns/docbook" \
218 <xsl:output method="text"/> \
219 <xsl:template match="/"> \
220 <xsl:if test="//refentry|//db:refentry"> \
221 <xsl:text>true</xsl:text> \
222 </xsl:if> \
223 </xsl:template> \
224 </xsl:stylesheet>
226 # -----------------------------------------------------------------
227 # ** Stylesheet Customization Layers **
228 # -----------------------------------------------------------------
230 # for DBLaTeX
231 DBX_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
232 version="1.0"> \
233 <xsl:param name="co.linkends.show">0</xsl:param> \
234 <xsl:param name="callout.markup.circled">1</xsl:param> \
235 <xsl:param name="callout.linkends.hot">0</xsl:param> \
236 <xsl:param name="doc.publisher.show">1</xsl:param> \
237 <xsl:param name="term.breakline">1</xsl:param> \
238 <xsl:param name="doc.alignment">left</xsl:param> \
239 <xsl:param name="newtbl.use">1</xsl:param> \
240 <xsl:param name="latex.hyperparam"/> \
241 <xsl:param name="latex.style">docbook</xsl:param> \
242 <xsl:param name="latex.biblio.output">all</xsl:param> \
243 <xsl:param name="latex.bibfiles">""</xsl:param> \
244 <xsl:param name="latex.bibwidelabel">WIDELABEL</xsl:param> \
245 <xsl:param name="latex.output.revhistory">0</xsl:param> \
246 <xsl:param name="latex.figure.position">[htbp]</xsl:param> \
247 <xsl:param name="latex.figure.boxed">0</xsl:param> \
248 <xsl:param name="latex.babel.use">1</xsl:param> \
249 <xsl:param name="latex.babel.language"></xsl:param> \
250 <xsl:param name="latex.class.options">twoside</xsl:param> \
251 <xsl:param name="biblioentry.item.separator">, </xsl:param> \
252 <xsl:param name="refentry.xref.manvolnum">1</xsl:param> \
253 <xsl:param name="refsynopsis.title">Synopsis</xsl:param> \
254 <xsl:param name="refnamediv.title"></xsl:param> \
255 <xsl:param name="funcsynopsis.style">ansi</xsl:param> \
256 <xsl:param name="funcsynopsis.decoration">1</xsl:param> \
257 <xsl:param name="function.parens">0</xsl:param> \
258 <xsl:param name="classsynopsis.default.language">java</xsl:param> \
259 <xsl:param name="show.comments">0</xsl:param> \
260 </xsl:stylesheet>
262 # for FO output
265 # NOTE: The following changes may be required to the stock docbook stylesheets
266 # for double-sided output:
268 # In /usr/share/xml/docbook/stylesheet/nwalsh/fo:
270 # o Add '<xsl:attribute name="margin-left">0pc</xsl:attribute>'
271 # to the template 'footer.table'. This fixes number positioning in
272 # double-sided output.
273 # o In the test for generating 'section.head.marker', change
274 # the test '$double-sided != 0' to read '$double-sided > 1'.
275 # This disables section-name headings in favor of chapter-name
276 # headings.
278 # --dhilvert@auricle.dyndns.org, 12-Oct-2006
280 FO_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
281 xmlns:fo="http://www.w3.org/1999/XSL/Format" \
282 version="1.0"> \
283 <xsl:import href="$(DOCBOOK_XSL)/fo/docbook.xsl"/> \
284 <xsl:param name="$(PDF_MAKER).extensions">1</xsl:param> \
285 <xsl:param name="paper.type">Custom</xsl:param> \
286 <xsl:param name="commented.page.height">9.25in</xsl:param> \
287 <xsl:param name="commented.page.width">7.5in</xsl:param> \
288 <xsl:param name="page.height">PAPER_HEIGHT</xsl:param> \
289 <xsl:param name="page.width">PAPER_WIDTH</xsl:param> \
290 <xsl:param name="commented.page.margin.inner">3in</xsl:param> \
291 <xsl:param name="commented.page.margin.outer">3in</xsl:param> \
292 <xsl:param name="chapter.autolabel">1</xsl:param> \
293 <xsl:param name="section.autolabel">1</xsl:param> \
294 <xsl:param name="toc.section.depth">2</xsl:param> \
295 <xsl:param name="commented.toc.max.depth">2</xsl:param> \
296 <xsl:param name="double.sided">DOUBLE_SIDED</xsl:param> \
297 <xsl:param name="draft.watermark.image"></xsl:param> \
298 <xsl:param name="hyphenation">false</xsl:param> \
299 <xsl:param name="hyphenate.verbatim">1</xsl:param> \
300 <xsl:param name="alignment">left</xsl:param> \
301 <xsl:param name="refentry.generate.name">1</xsl:param> \
302 <xsl:param name="refentry.generate.title">0</xsl:param> \
303 <xsl:param name="refentry.pagebreak">1</xsl:param> \
304 <xsl:param name="shade.verbatim">1</xsl:param> \
305 <xsl:param name="variablelist.as.blocks">1</xsl:param> \
306 <xsl:param name="ulink.show">1</xsl:param> \
307 <xsl:param name="ulink.footnotes">1</xsl:param> \
308 <xsl:param name="index.on.type">1</xsl:param> \
309 <xsl:attribute-set name="xref.properties"> \
310 <xsl:attribute name="color">XREF_COLOR</xsl:attribute> \
311 </xsl:attribute-set> \
312 <xsl:template match="section[@tocexclude = 1]" mode="toc" /> \
313 <xsl:template name="commented.page.number.format"> \
314 <xsl:param name="element" select="local-name(.)"/> \
315 <xsl:choose> \
316 <xsl:when test="$element = 'toc'">i</xsl:when> \
317 <xsl:when test="$element = 'preface'">i</xsl:when> \
318 <xsl:when test="$element = 'dedication'">i</xsl:when> \
319 <xsl:when test="$element = 'book'">i</xsl:when> \
320 <xsl:when test="$element = 'set'">i</xsl:when> \
321 <xsl:otherwise>1</xsl:otherwise> \
322 </xsl:choose> \
323 </xsl:template> \
324 <xsl:template match="*" mode="toc.for.set"> \
325 <xsl:call-template name="set.toc"/> \
326 </xsl:template> \
327 <xsl:attribute-set name="shade.verbatim.style"> \
328 <xsl:attribute name="background-color">\#E0E0E0</xsl:attribute> \
329 <xsl:attribute name="padding-left">4pt</xsl:attribute> \
330 <xsl:attribute name="padding-right">4pt</xsl:attribute> \
331 <xsl:attribute name="padding-top">4pt</xsl:attribute> \
332 <xsl:attribute name="padding-bottom">4pt</xsl:attribute> \
333 </xsl:attribute-set> \
334 <xsl:attribute-set name="section.title.level1.properties"> \
335 <xsl:attribute name="font-size"> \
336 <xsl:value-of select="$$body.font.master * 1.5"></xsl:value-of> \
337 <xsl:text>pt</xsl:text> \
338 </xsl:attribute> \
339 </xsl:attribute-set> \
340 <xsl:attribute-set name="section.title.level2.properties"> \
341 <xsl:attribute name="font-size"> \
342 <xsl:value-of select="$$body.font.master * 1.3"></xsl:value-of> \
343 <xsl:text>pt</xsl:text> \
344 </xsl:attribute> \
345 </xsl:attribute-set> \
346 <xsl:attribute-set name="section.title.level3.properties"> \
347 <xsl:attribute name="font-size"> \
348 <xsl:value-of select="$$body.font.master * 1.1"></xsl:value-of> \
349 <xsl:text>pt</xsl:text> \
350 </xsl:attribute> \
351 </xsl:attribute-set> \
352 <xsl:attribute-set name="section.title.level4.properties"> \
353 <xsl:attribute name="font-size"> \
354 <xsl:value-of select="$$body.font.master"></xsl:value-of> \
355 <xsl:text>pt</xsl:text> \
356 </xsl:attribute> \
357 </xsl:attribute-set> \
358 <xsl:attribute-set name="component.title.properties"> \
359 <xsl:attribute name="font-size"> \
360 <xsl:value-of select="$$body.font.master * 1.5"></xsl:value-of> \
361 <xsl:text>pt</xsl:text> \
362 </xsl:attribute> \
363 </xsl:attribute-set> \
364 <xsl:attribute-set name="monospace.verbatim.properties"> \
365 <xsl:attribute name="wrap-option">wrap</xsl:attribute> \
366 <xsl:attribute name="hyphenation-character">\</xsl:attribute> \
367 <xsl:attribute name="font-size"> \
368 <xsl:value-of select="$$body.font.master * 0.8"></xsl:value-of> \
369 <xsl:text>pt</xsl:text> \
370 </xsl:attribute> \
371 </xsl:attribute-set> \
372 </xsl:stylesheet>
374 FO_LETTER_COLOR := $(subst PAPER_WIDTH, 8.5in, \
375 $(subst PAPER_HEIGHT, 11in, \
376 $(subst XREF_COLOR,blue, \
377 $(subst DOUBLE_SIDED, 0, \
378 $(FO_CUSTOM)))))
380 FO_LETTER_MONO := $(subst PAPER_WIDTH, 8.5in, \
381 $(subst PAPER_HEIGHT, 11in, \
382 $(subst XREF_COLOR,black, \
383 $(subst DOUBLE_SIDED, 0, \
384 $(FO_CUSTOM)))))
386 FO_SMALL_COLOR := $(subst PAPER_WIDTH, 7.5in, \
387 $(subst PAPER_HEIGHT, 9.25in, \
388 $(subst XREF_COLOR,blue, \
389 $(subst DOUBLE_SIDED, 1, \
390 $(FO_CUSTOM)))))
392 FO_SMALL_MONO := $(subst PAPER_WIDTH, 7.5in, \
393 $(subst PAPER_HEIGHT, 9.25in, \
394 $(subst XREF_COLOR,black, \
395 $(subst DOUBLE_SIDED, 1, \
396 $(FO_CUSTOM)))))
398 # for single-file (X)HTML outpout
399 HTML_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
400 version="1.0"> \
401 <xsl:import href="$(DOCBOOK_XSL)/$(HTML_OR_XHTML)/docbook.xsl"/> \
402 <xsl:param name="gentext.custom">local.l10n.xml</xsl:param> \
403 <xsl:param name="local.l10n.xml" select="document($$gentext.custom)"/> \
404 <xsl:param name="refentry.generate.name">1</xsl:param> \
405 <xsl:param name="refentry.generate.title">0</xsl:param> \
406 <xsl:param name="root.filename"></xsl:param> \
407 <xsl:param name="variablelist.as.table">0</xsl:param> \
408 <xsl:param name="html.stylesheet">$(HTML_STYLESHEET)</xsl:param> \
409 <xsl:param name="admon.graphics">0</xsl:param> \
410 <xsl:param name="index.on.type">1</xsl:param> \
411 <xsl:param name="chapter.autolabel">1</xsl:param> \
412 <xsl:param name="section.autolabel">1</xsl:param> \
413 <xsl:param name="toc.section.depth">2</xsl:param> \
414 <xsl:param name="commented.toc.max.depth">2</xsl:param> \
415 <xsl:template match="section[@tocexclude = 1]" mode="toc" /> \
416 <xsl:param name="generate.toc"> \
417 appendix toc,title \
418 article/appendix nop \
419 article toc, title \
420 book toc,title,figure,table,example,equation \
421 chapter toc,title \
422 part toc,title \
423 preface toc,title \
424 qandadiv toc \
425 qandaset toc \
426 reference toc,title \
427 sect1 toc \
428 sect2 toc \
429 sect3 toc \
430 sect4 toc \
431 sect5 toc \
432 section toc \
433 set toc,title \
434 </xsl:param> \
435 </xsl:stylesheet>
437 # for chunked (X)HTML output
438 CHNK_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
439 version="1.0"> \
440 <xsl:import href="$(DOCBOOK_XSL)/$(HTML_OR_XHTML)/chunk.xsl"/> \
441 <xsl:param name="refentry.generate.name">0</xsl:param> \
442 <xsl:param name="refentry.generate.title">1</xsl:param> \
443 <xsl:param name="variablelist.as.table">0</xsl:param> \
444 <xsl:param name="html.stylesheet">$(HTML_STYLESHEET)</xsl:param> \
445 <xsl:param name="admon.graphics">1</xsl:param> \
446 <xsl:param name="admon.graphics.path">$(HTML_IMAGES)</xsl:param> \
447 <xsl:param name="admon.graphics.extension">$(HTML_IMAGES_EXT)</xsl:param> \
448 <xsl:param name="root.filename"></xsl:param> \
449 <xsl:param name="generate.manifest">1</xsl:param> \
450 <xsl:param name="use.id.as.filename">1</xsl:param> \
451 <xsl:param name="chunker.output.indent">yes</xsl:param> \
452 <xsl:param name="index.on.type">1</xsl:param> \
453 <xsl:param name="chapter.autolabel">1</xsl:param> \
454 <xsl:param name="section.autolabel">1</xsl:param> \
455 <xsl:param name="toc.section.depth">2</xsl:param> \
456 <xsl:param name="commented.toc.max.depth">2</xsl:param> \
457 <xsl:template match="section[@tocexclude = 1]" mode="toc" /> \
458 <xsl:param name="generate.toc"> \
459 appendix toc,title \
460 article/appendix nop \
461 article toc,title \
462 book toc,title,figure,table,example,equation \
463 chapter toc,title \
464 part toc,title \
465 preface toc,title \
466 qandadiv toc \
467 qandaset toc \
468 reference toc,title \
469 sect1 toc \
470 sect2 toc \
471 sect3 toc \
472 sect4 toc \
473 sect5 toc \
474 section toc \
475 set toc,title \
476 </xsl:param> \
477 </xsl:stylesheet>
479 # for man-page output
480 MAN_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
481 version="1.0"> \
482 <xsl:import href="$(DOCBOOK_XSL)/manpages/docbook.xsl"/> \
483 <xsl:param name="man.output.manifest.enabled" select="1"/> \
484 <xsl:param name="man.output.in.separate.dir" select="1"/> \
485 <xsl:param name="man.output.base.dir">man/</xsl:param> \
486 <xsl:param name="man.output.subdirs.enabled" select="1"/> \
487 </xsl:stylesheet>
490 # ALE documentation targets
493 ALE_SUBDIRS := user technical
494 ALE_TYPES := letter.pdf txt info
495 ALE_PACKAGE := TODO ChangeLog NEWS README REPORTING-BUGS
496 ALE_MANUALS := $(foreach subdir, $(ALE_SUBDIRS), $(subdir)-manual)
497 ALE_MANUAL_TARGETS := $(foreach manual, $(ALE_MANUALS), $(foreach type, $(ALE_TYPES), $(manual).$(type)))
498 ALE_PACKAGE_TARGETS := $(foreach package, $(ALE_PACKAGE), ../$(package))
499 ALE_TARGETS := $(ALE_MANUAL_TARGETS) $(ALE_PACKAGE_TARGETS)
502 # -----------------------------------------------------------------
503 # ** TARGETS START HERE **
504 # -----------------------------------------------------------------
505 # prevents make from deleting, e.g. foo.1, after making foo.1.pdf
506 # and foo.1.txt from it.
507 .PRECIOUS: %.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9
509 # docbook: index.docbook $(DOCBOOK_OUTPUT_FORMATS) ../TODO ../ChangeLog ../NEWS ../README ../REPORTING-BUGS
510 docbook: $(ALE_TARGETS) index.docbook chunk
511 rm -rf html
512 mv index html
513 mkdir -p info; mv *.info info
514 rm index.docbook
516 %-manual.docbook: %/index.xml
517 $(XSLT) $(XSLT_FLAGS) ale-doc.xsl $< > $@
519 manual-set.docbook: index.xml
520 $(XSLT) $(XSLT_FLAGS) ale-doc.xsl $< > $@
522 ../TODO: package/todo/index.txt
523 mv package/todo/index.txt ../TODO
525 ../ChangeLog: package/changelog/index.txt
526 mv package/changelog/index.txt ../ChangeLog
528 ../NEWS: package/news/index.txt
529 mv package/news/index.txt ../NEWS
531 ../README: package/readme/index.txt
532 mv package/readme/index.txt ../README
534 man: $(LISTS_MAN)
536 # we can generate PDFs from man pages
537 man-pdf: man
538 $(MAKE) $(FILES_MANP)
540 # we can generate plain text from man pages
541 man-txt: man
542 $(MAKE) $(FILES_MANT)
544 html: $(FILES_HTML)
546 chunk: $(LISTS_HTML)
548 txt: $(FILES_TXT)
550 pdf: $(FILES_PDF)
552 info: $(FILES_INFO)
554 # use the "debug" target to echo variables, etc., to
555 # test/troubleshoot changes you make to this makefile
556 debug:
557 @echo $(DIRS_MAN)
559 # -----------------------------------------------------------------
560 # preprocess xml to docbook.
561 # -----------------------------------------------------------------
562 %$(DOCBOOK_FILE_EXTENSION): %.xml $(BROKEN_DEPENDENCIES) ale-doc.xsl
563 $(XSLT) $(XSLT_FLAGS) ale-doc.xsl $< > $@
565 package/changelog/index.xml: package/changelog/index.in ./make-changelog
566 ./make-changelog < package/changelog/index.in > package/changelog/index.xml
568 # -----------------------------------------------------------------
569 # pattern rule for making (X)HTML and plain-text output
570 # -----------------------------------------------------------------
571 %.html: %$(DOCBOOK_FILE_EXTENSION) $(BROKEN_DEPENDENCIES)
572 @echo '$(HTML_CUSTOM)' | $(XSLT) $(XSLT_FLAGS) $(HTML_PARAMS) - $< > $@
574 %.txt: %.html
575 $(TXT_MAKER) $(TXT_MAKER_FLAGS) ./$< \
576 | sed "s/^\(\s\+[0-9]\+\. \)file:\/\/.\+$$/\\1(local)/g" \
577 | egrep -v '^ file:///.+$$' \
578 > $@
579 # if DOCBOOK_OUTPUT_FORMATS does not contain "html", then we need
580 # to remove the "intermediate" HTML files we used for generating
581 # plain-text output
582 ifeq ($(findstring html,$(DOCBOOK_OUTPUT_FORMATS)),)
583 $(RM) $<
584 endif
586 # -----------------------------------------------------------------
587 # pattern rule for making chunked (X)HTML pages
588 # -----------------------------------------------------------------
589 %.$(HTML_MANIFEST_EXT): %$(DOCBOOK_FILE_EXTENSION) $(BROKEN_DEPENDENCIES)
590 @echo '$(CHNK_CUSTOM)' | $(XSLT) $(XSLT_FLAGS) $(HTML_PARAMS) \
591 --stringparam manifest $@ \
592 --stringparam base.dir $(basename $@)$(BASEDIR_SUFFIX)/ \
593 - $<
595 # -----------------------------------------------------------------
596 # pattern rules for making FO and PDF stuff
597 # -----------------------------------------------------------------
598 %.letter.fo: %$(DOCBOOK_FILE_EXTENSION) $(BROKEN_DEPENDENCIES)
599 @echo '$(FO_LETTER_COLOR)' \
600 | $(XSLT) $(XSLT_FLAGS) $(FO_PARAMS) - $< > $@
602 %.small.fo: %$(DOCBOOK_FILE_EXTENSION) $(BROKEN_DEPENDENCIES)
603 @echo '$(FO_SMALL_COLOR)' \
604 | $(XSLT) $(XSLT_FLAGS) $(FO_PARAMS) - $< > $@
606 %.letter-mono.fo: %$(DOCBOOK_FILE_EXTENSION) $(BROKEN_DEPENDENCIES)
607 @echo '$(FO_LETTER_MONO)' \
608 | $(XSLT) $(XSLT_FLAGS) $(FO_PARAMS) - $< > $@
610 %.small-mono.fo: %$(DOCBOOK_FILE_EXTENSION) $(BROKEN_DEPENDENCIES)
611 @echo '$(FO_SMALL_MONO)' \
612 | $(XSLT) $(XSLT_FLAGS) $(FO_PARAMS) - $< > $@
614 ifeq ($(PDF_MAKER),dblatex)
615 %.pdf: %$(DOCBOOK_FILE_EXTENSION)
616 mkdir -p $(DOCBOOK_TMP)
617 echo '$(DBX_CUSTOM)' > $(DOCBOOK_TMP)/dblatex.xsl
618 -$(DBLATEX) $(DBLATEX_FLAGS)\
619 -p $(DOCBOOK_TMP)/dblatex.xsl \
620 -o $@ \
622 $(RM) -r $(DOCBOOK_TMP)
623 endif
625 %.pdf: %.fo
626 ifeq ($(PDF_MAKER),)
627 $(error No PDF_MAKER specified. Cannot make pdf)
628 else
629 ifeq ($(PDF_MAKER),xep)
630 $(XEP) $(XEP_FLAGS) $< $@
631 else
632 ifeq ($(PDF_MAKER),fop)
633 $(FOP) $(FOP_FLAGS) $< $@
634 else
635 ifeq ($(PDF_MAKER),xmlroff)
636 $(XMLROFF) $(XMLROFF_FLAGS) $< -o $@
637 else
638 ifeq ($(PDF_MAKER),passivetex)
639 $(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $<
640 @if [ `egrep Rerun $(basename $@).log | wc -l` -gt 0 ]; then \
641 $(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $< ; \
643 @if [ `egrep Rerun $(basename $@).log | wc -l` -gt 0 ]; then \
644 $(PDFTEX) $(PDFTEX_FLAGS) &$(PDFXMLTEX) $< ; \
646 $(RM) $(basename $@).log
647 $(RM) $(basename $@).aux
648 $(RM) $(basename $@).out
649 else
650 $(error I do not know how to make a PDF using "$(PDF_MAKER)")
651 endif
652 endif
653 endif
654 endif
655 endif
657 # -----------------------------------------------------------------
658 # pattern rules for making TeXinfo stuff
659 # -----------------------------------------------------------------
660 %.txml: %$(DOCBOOK_FILE_EXTENSION)
661 $(DB2X_XSLTPROC) $(DB2X_XSLTPROC_FLAGS) -s texi -o $@ $<
663 %.texi-list: %.txml
664 $(DB2X_TEXIXML) $(DB2X_TEXIXML_FLAGS) $< > $@
666 # the following is actually a built-in rule, but it's redefined
667 # here just for the sake of clarity
668 %.info: %.texi-list
669 /usr/bin/perl -w make-infos $(MAKEINFO) < $<
670 -@ # This doesn't work in general.
671 -@ # $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@
673 # -----------------------------------------------------------------
674 # pattern rule for making man pages
675 # -----------------------------------------------------------------
676 %.$(MAN_MANIFEST_EXT): %$(DOCBOOK_FILE_EXTENSION)
677 @if [ "$(strip $(shell echo '$(REFENTRY_CHECK)' | $(XSLT) $(XSLT_FLAGS) - $<))" != "true" ]; then \
678 touch $@; \
679 else \
680 echo '$(MAN_CUSTOM)' \
681 | $(XSLT) $(XSLT_FLAGS) $(MAN_PARAMS) \
682 --stringparam man.output.manifest.filename $@ \
683 - $<; \
686 # -----------------------------------------------------------------
687 # pattern rule for enabling direct "make foo.1" to work
688 # -----------------------------------------------------------------
690 %.1 %.2 %.3 %.4 %.5 %.6 %.7: %.xml
691 $(MAKE) $(basename $<).$(MAN_MANIFEST_EXT)
693 # -----------------------------------------------------------------
694 # pattern rules for making Postscript/PDF output from man pages
695 # -----------------------------------------------------------------
696 %.1.ps: %.1
697 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
699 %.2.ps: %.2
700 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
702 %.3.ps: %.3
703 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
705 %.4.ps: %.4
706 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
708 %.5.ps: %.5
709 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
711 %.6.ps: %.6
712 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
714 %.7.ps: %.7
715 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
717 %.8.ps: %.8
718 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
720 %.9.ps: %.9
721 $(MAN) -l $(MAN_FLAGS) -Tps $< > $@
723 # -----------------------------------------------------------------
724 # pattern rule for converting Postscript to PDF
725 # -----------------------------------------------------------------
726 %.pdf: %.ps
727 $(PS2PDF) $(PS2PDF_FLAGS) $<
729 # -----------------------------------------------------------------
730 # pattern rules for making plain-text output from man pages
731 # -----------------------------------------------------------------
732 %.1.txt: %.1
733 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
735 %.2.txt: %.2
736 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
738 %.3.txt: %.3
739 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
741 %.4.txt: %.4
742 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
744 %.5.txt: %.5
745 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
747 %.6.txt: %.6
748 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
750 %.7.txt: %.7
751 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
753 %.8.txt: %.8
754 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
756 %.9.txt: %.9
757 $(MAN) -l $(MAN_FLAGS) -Tascii $< | $(COL) -b $(COL_FLAGS) | $(EXPAND) $(EXPAND_FLAGS) > $@
759 # -----------------------------------------------------------------
760 # target(s) for cleaning up the mess
761 # -----------------------------------------------------------------
762 clean:
763 find . -name "*.info" | xargs rm -f
764 find . -name "*.texi" | xargs rm -f
765 find . -name "*.texi-list" | xargs rm -f
766 find . -name "*.pdf" | xargs rm -f
767 find . -name "*.fo" | xargs rm -f
768 find . -name "*.docbook" | xargs rm -f
769 find . -name "*.txt" | xargs rm -f
770 rm -f package/changelog/index.xml
771 rm -rf index
772 rm -rf html
773 ifneq ($(FILES_TXT),)
774 $(RM) $(FILES_TXT)
775 endif
776 ifneq ($(FILES_PDF),)
777 $(RM) $(FILES_PDF)
778 endif
779 ifneq ($(FILES_FO),)
780 $(RM) $(FILES_FO)
781 endif
782 ifneq ($(FILES_LOG),)
783 $(RM) $(FILES_LOG)
784 endif
785 ifneq ($(FILES_OUT),)
786 $(RM) $(FILES_OUT)
787 endif
788 ifneq ($(FILES_AUX),)
789 $(RM) $(FILES_AUX)
790 endif
791 ifneq ($(FILES_HTML),)
792 $(RM) $(FILES_HTML)
793 endif
794 ifneq ($(FILES_CHNK),)
795 $(RM) $(FILES_CHNK)
796 endif
797 ifneq ($(FILES_MAN),)
798 $(RM) $(FILES_MAN)
799 endif
800 ifneq ($(FILES_MANT),)
801 $(RM) $(FILES_MANT)
802 endif
803 ifneq ($(FILES_MANP),)
804 $(RM) $(FILES_MANP)
805 endif
806 ifneq ($(FILES_INFO),)
807 $(RM) $(FILES_INFO)
808 endif
809 ifneq ($(DIRS_CHUNK),)
810 for dir in $(DIRS_CHUNK); do \
811 if [ -d "$$dir" ]; then \
812 $(RMDIR) $(RMDIR_FLAGS) $$dir; \
813 fi \
814 done
815 endif
816 ifneq ($(DIRS_MAN),)
817 ifneq ($(DIRS_MAN),.)
818 for dir in $(DIRS_MAN); do \
819 if [ -d "$$dir" ]; then \
820 $(RMDIR) $(RMDIR_FLAGS) $$dir; \
821 fi \
822 done
823 endif
824 endif
825 ifneq ($(LISTS_MAN),)
826 $(RM) $(LISTS_MAN)
827 endif
828 ifneq ($(LISTS_HTML),)
829 $(RM) $(LISTS_HTML)
830 endif