Makefile.DocBook 24 KB

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