2 # $DragonFly: doc/share/mk/doc.docbook.mk,v 1.3 2006/08/06 20:58:06 justin Exp $
4 # $FreeBSD: doc/share/mk/doc.docbook.mk,v 1.117 2004/09/02 17:12:14 murray Exp $
6 # This include file <doc.docbook.mk> handles building and installing of
7 # DocBook documentation in the DragonFlyBSD Documentation Project.
9 # Documentation using DOCFORMAT=docbook is expected to be marked up
10 # according to the DocBook DTD
13 # ------------------------------------------------------------------------
15 # Document-specific variables
17 # DOC This should be set to the name of the DocBook
18 # marked-up file, without the .sgml suffix.
20 # It also determins the name of the output files -
23 # DOCBOOKSUFFIX The suffix of your document, defaulting to .sgml
25 # SRCS The names of all the files that are needed to
26 # build this document - This is useful if any of
27 # them need to be generated. Changing any file in
28 # SRCS causes the documents to be rebuilt.
30 # HAS_INDEX This document has index terms and so an index
31 # can be created if specified with GEN_INDEX.
34 # ------------------------------------------------------------------------
36 # Variables used by both users and documents:
38 # SGMLFLAGS Additional options to pass to various SGML
39 # processors (e.g., jade, nsgmls). Typically
40 # used to define "IGNORE" entities to "INCLUDE"
41 # with "-i<entity-name>"
43 # JADEFLAGS Additional options to pass to Jade. Typically
44 # used to set additional variables, such as
45 # "%generate-article-toc%".
47 # TIDYFLAGS Additional flags to pass to Tidy. Typically
48 # used to set "-raw" flag to handle 8bit characters.
50 # EXTRA_CATALOGS Additional catalog files that should be used by
51 # any SGML processing applications.
53 # NO_TIDY If you do not want to use tidy, set this to "YES".
55 # GEN_INDEX If this document has an index (HAS_INDEX) and this
56 # variable is defined, then index.sgml will be added
57 # to the list of dependencies for source files, and
58 # collateindex.pl will be run to generate index.sgml.
60 # CSS_SHEET Full path to a CSS stylesheet suitable for DocBook.
61 # Default is ${DOC_PREFIX}/share/misc/docbook.css
64 # SPELLCHECK Use the special spellcheck.dsl stylesheet to render
65 # HTML that is suitable for processing through a
66 # spellchecker. For example, PGP keys and filenames
67 # will be ommitted from this output.
69 # Print-output options :
71 # NICE_HEADERS If defined, customized chapter headers will be created
72 # that you may find more aesthetically pleasing. Note
73 # that this option only effects print output formats for
74 # Enlish language books.
76 # MIN_SECT_LABELS If defined, do not display the section number for 4th
77 # and 5th level section titles. This would change
78 # "N.N.N.N Section title" into "Section Title" while
79 # higher level sections are still printed with numbers.
81 # TRACE={1,2} Trace TeX's memory usage. Set this to 1 for minimal
82 # tracing or 2 for maximum tracing. TeX memory
83 # statistics will be written out to <filename>.log.
84 # For more information see the TeXbook, p301.
86 # TWO_SIDE If defined, two sided output will be created. This
87 # means that new chapters will only start on odd
88 # numbered (aka right side, aka recto) pages and the
89 # headers and footers will be aligned appropriately
90 # for double sided paper. Blank pages may be added as
93 # JUSTIFY If defined, text will be right justified so that the
94 # right edge is smooth. Words may be hyphenated using
95 # the defalt TeX hyphenation rules for this purpose.
97 # BOOK_OUTPUT A collection of options are set suitable for printing
98 # a book. This option may be an order of magnitude more
99 # CPU intensive than the default build.
101 # RLE Use Run-Length Encoding for EPS files, this will
102 # result in signficiantly smaller PostScript files,
103 # but may take longer for a printer to process.
105 # GREYSCALE_IMAGES Convert the screenshots to greyscale before
106 # embedding them into the PostScript output.
108 # Package building options:
110 # BZIP2_PACKAGE Use bzip2(1) utility to compress package tarball
111 # instead of gzip(1). It results packages to have
112 # suffix .tbz instead of .tgz. Using bzip2(1)
113 # provides better compression, but requires longer
114 # time and utilizes more CPU resources than gzip(1).
117 # Documents should use the += format to access these.
122 MASTERDOC?= ${.CURDIR}/${DOC}.${DOCBOOKSUFFIX}
124 # List of supported SP_ENCODINGs
125 SP_ENCODING_LIST?= ISO-8859-2 KOI8-R
127 # Which stylesheet type to use. 'dsssl' or 'xsl'
128 STYLESHEET_TYPE?= dsssl
130 .if ${MACHINE_ARCH} != "i386"
134 .if defined(SPELLCHECK)
135 DSLHTML?= ${DOC_PREFIX}/share/sgml/spellcheck.dsl
138 .if defined(OPENJADE)
139 JADE?= ${PREFIX}/bin/openjade
140 JADECATALOG?= ${PREFIX}/share/sgml/openjade/catalog
141 NSGMLS?= ${PREFIX}/bin/onsgmls
142 JADEFLAGS+= -V openjade
143 SX?= ${PREFIX}/bin/osx
145 JADE?= ${PREFIX}/bin/jade
146 JADECATALOG?= ${PREFIX}/share/sgml/jade/catalog
147 NSGMLS?= ${PREFIX}/bin/nsgmls
148 NSGMLSWARNINGS= -wempty -wunclosed
149 SX?= ${PREFIX}/bin/sx
152 .if defined(SP_ENCODING)
153 JADE_ENV+= SP_ENCODING=${SP_ENCODING}
155 JADE_CMD= ${SETENV} ${JADE_ENV} ${JADE}
157 DSLHTML?= ${DOC_PREFIX}/share/sgml/default.dsl
158 DSLPRINT?= ${DOC_PREFIX}/share/sgml/default.dsl
159 DSLPGP?= ${DOC_PREFIX}/share/sgml/pgp.dsl
160 DRAGONFLYBSDCATALOG= ${DOC_PREFIX}/share/sgml/catalog
161 LANGUAGECATALOG=${DOC_PREFIX}/${LANGCODE}/share/sgml/catalog
163 ISO8879CATALOG= ${PREFIX}/share/sgml/iso8879/catalog
165 .if ${STYLESHEET_TYPE} == "dsssl"
166 DOCBOOKCATALOG= ${PREFIX}/share/sgml/docbook/4.1/catalog
167 .elif ${STYLESHEET_TYPE} == "xsl"
168 DOCBOOKCATALOG= ${PREFIX}/share/xml/docbook/catalog
171 CATALOG_PORTS_SGML= ${PREFIX}/share/sgml/catalog
173 DSSSLCATALOG= ${PREFIX}/share/sgml/docbook/dsssl/modular/catalog
174 COLLATEINDEX= ${PREFIX}/share/sgml/docbook/dsssl/modular/bin/collateindex.pl
176 XSLTPROCFLAGS?= --nonet
177 XSLHTML?= ${DOC_PREFIX}/share/xsl/dragonfly-html.xsl
178 XSLHTMLCHUNK?= ${DOC_PREFIX}/share/xsl/dragonfly-html-chunk.xsl
179 XSLFO?= ${DOC_PREFIX}/share/xsl/dragonfly-fo.xsl
180 INDEXREPORTSCRIPT= ${DOC_PREFIX}/share/misc/indexreport.pl
184 .for c in ${LANGUAGECATALOG} ${DRAGONFLYBSDCATALOG} ${DSSSLCATALOG} ${ISO8879CATALOG} ${DOCBOOKCATALOG} ${JADECATALOG} ${EXTRA_CATALOGS} ${CATALOG_PORTS_SGML}
189 SGMLFLAGS+= -D ${CANONICALOBJDIR}
190 JADEOPTS= ${JADEFLAGS} ${SGMLFLAGS} ${CATALOGS}
191 XSLTPROCOPTS= ${XSLTPROCFLAGS}
193 KNOWN_FORMATS= html html.tar html-split html-split.tar \
194 txt rtf rtf.tar ps pdf tex dvi tar pdb
196 CSS_SHEET?= ${DOC_PREFIX}/share/misc/docbook.css
197 PDFTEX_DEF?= ${DOC_PREFIX}/share/web2c/pdftex.def
198 PDF_GENINFO?= ${DOC_PREFIX}/share/web2c/pdf_geninfo.sh
200 HTMLOPTS?= -ioutput.html -d ${DSLHTML} ${HTMLFLAGS}
202 HTMLTXTOPTS?= -ioutput.html -d ${DSLHTML} ${HTMLTXTFLAGS}
204 PRINTOPTS?= -ioutput.print -d ${DSLPRINT} ${PRINTFLAGS}
206 .if defined(BOOK_OUTPUT)
215 TEX_CMDSEQ+= \RequirePackage{url}
216 PRINTOPTS+= -ioutput.print.justify
218 .if defined(TWO_SIDE)
219 PRINTOPTS+= -V %two-side% -ioutput.print.twoside
220 TEX_CMDSEQ+= \def\PageTwoSide{1}
222 .if defined(NICE_HEADERS)
223 PRINTOPTS+= -ioutput.print.niceheaders
225 .if defined(MIN_SECT_LABELS)
226 PRINTOPTS+= -V minimal-section-labels
229 TEX_CMDSEQ+= \tracingstats=${TRACE}
235 .if !defined(WITH_INLINE_LEGALNOTICE) || empty(WITH_INLINE_LEGALNOTICE)
236 HTMLFLAGS+= -V %generate-legalnotice-link%
238 .if defined(WITH_ARTICLE_TOC) && !empty(WITH_ARTICLE_TOC)
239 HTMLFLAGS+= -V %generate-article-toc%
240 #PRINTFLAGS+= -V %generate-article-toc%
242 .if defined(WITH_BIBLIOXREF_TITLE) && !empty(WITH_BIBLIOXREF_TITLE)
243 HTMLFLAGS+= -V biblio-xref-title
244 PRINTFLAGS+= -V biblio-xref-title
246 .if defined(WITH_DOCFORMAT_NAVI_LINK) && !empty(WITH_DOCFORMAT_NAVI_LINK)
247 HTMLFLAGS+= -V %generate-docformat-navi-link%
248 .elif (${FORMATS:Mhtml} == "html") && (${FORMATS:Mhtml-split} == "html-split")
249 HTMLFLAGS+= -V %generate-docformat-navi-link%
251 .if defined(WITH_ALL_TRADEMARK_SYMBOLS) && !empty(WITH_ALL_TRADEMARK_SYMBOLS)
252 HTMLFLAGS+= -V %show-all-trademark-symbols%
253 PRINTFLAGS+= -V %show-all-trademark-symbols%
256 PERL?= ${PREFIX}/bin/perl
257 PKG_CREATE?= /usr/sbin/pkg_create
260 TOUCH?= /usr/bin/touch
261 XARGS?= /usr/bin/xargs
264 TIDYOPTS?= -wrap 90 -m -raw -preserve -f /dev/null -asxml ${TIDYFLAGS}
265 HTML2TXT?= ${PREFIX}/bin/links
266 HTML2TXTOPTS?= -dump ${HTML2TXTFLAGS}
267 HTML2PDB?= ${PREFIX}/bin/iSiloBSD
268 HTML2PDBOPTS?= -y -d0 -Idef ${HTML2PDBFLAGS}
269 DVIPS?= ${PREFIX}/bin/dvips
270 .if defined(PAPERSIZE)
271 DVIPSOPTS?= -t ${PAPERSIZE:L}
273 DVIPSOPTS+= ${DVIPSFLAGS}
276 GZIP_CMD?= gzip -qf ${GZIP}
278 BZIP2_CMD?= bzip2 -qf ${BZIP2}
280 ZIP_CMD?= ${PREFIX}/bin/zip -j ${ZIP}
283 # Instruction for bsd.subdir.mk to not to process SUBDIR directive.
284 # It is not neccessary since doc.docbook.mk do it too.
289 # ------------------------------------------------------------------------
291 # Look at ${FORMATS} and work out which documents need to be generated.
292 # It is assumed that the HTML transformation will always create a file
293 # called index.html, and that for every other transformation the name
294 # of the generated file is ${DOC}.format.
296 # ${_docs} will be set to a list of all documents that must be made
299 # ${CLEANFILES} is a list of files that should be removed by the "clean"
300 # target. ${COMPRESS_EXT:S/^/${DOC}.${_cf}.&/ takes the COMPRESS_EXT
301 # var, and prepends the filename to each listed extension, building a
302 # second list of files with the compressed extensions added.
305 # Note: ".for _curformat in ${KNOWN_FORMATS}" is used several times in
306 # this file. I know they could have been rolled together in to one, much
307 # larger, loop. However, that would have made things more complicated
308 # for a newcomer to this file to unravel and understand, and a syntax
309 # error in the loop would have affected the entire
310 # build/compress/install process, instead of just one of them, making it
311 # more difficult to debug.
314 # Note: It is the aim of this file that *all* the targets be available,
315 # not just those appropriate to the current ${FORMATS} and
316 # ${INSTALL_COMPRESSED} values.
318 # For example, if FORMATS=html and INSTALL_COMPRESSED=gz you could still
323 # and it will do the right thing. Or
325 # make install-rtf.bz2
327 # for that matter. But don't expect "make clean" to work if the FORMATS
328 # and INSTALL_COMPRESSED variables are wrong.
331 .if ${.OBJDIR} != ${.CURDIR}
332 LOCAL_CSS_SHEET= ${.OBJDIR}/${CSS_SHEET:T}
334 LOCAL_CSS_SHEET= ${CSS_SHEET:T}
337 .for _curformat in ${FORMATS}
340 .if ${_cf} == "html-split"
341 _docs+= index.html HTML.manifest ln*.html
342 CLEANFILES+= $$([ -f HTML.manifest ] && ${XARGS} < HTML.manifest) \
343 HTML.manifest ln*.html
344 CLEANFILES+= PLIST.${_curformat}
347 _docs+= ${DOC}.${_curformat}
348 CLEANFILES+= ${DOC}.${_curformat}
349 CLEANFILES+= PLIST.${_curformat}
351 .if ${_cf} == "html-split.tar"
352 CLEANFILES+= $$([ -f HTML.manifest ] && ${XARGS} < HTML.manifest) \
353 HTML.manifest ln*.html
355 .elif ${_cf} == "html.tar"
356 CLEANFILES+= ${DOC}.html
358 .elif ${_cf} == "txt"
359 CLEANFILES+= ${DOC}.html-text
361 .elif ${_cf} == "dvi"
362 CLEANFILES+= ${DOC}.aux ${DOC}.log ${DOC}.tex
364 .elif ${_cf} == "tex"
365 CLEANFILES+= ${DOC}.aux ${DOC}.log
368 CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.tex-ps ${DOC}.tex
369 .for _curimage in ${LOCAL_IMAGES_EPS:M*share*}
370 CLEANFILES+= ${_curimage:T} ${_curimage:H:T}/${_curimage:T}
373 .elif ${_cf} == "pdf"
374 CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.out ${DOC}.tex-pdf \
376 .for _curimage in ${IMAGES_PDF:M*share*}
377 CLEANFILES+= ${_curimage:T} ${_curimage:H:T}/${_curimage:T}
379 .for _curimage in ${LOCAL_IMAGES_EPS:M*share*}
380 CLEANFILES+= ${_curimage:T} ${_curimage:H:T}/${_curimage:T}
383 .elif ${_cf} == "pdb"
384 _docs+= ${.CURDIR:T}.pdb
385 CLEANFILES+= ${.CURDIR:T}.pdb
390 .if (${STYLESHEET_TYPE} == "xsl")
394 .if (${LOCAL_CSS_SHEET} != ${CSS_SHEET}) && \
395 (${_cf} == "html-split" || ${_cf} == "html-split.tar" || \
396 ${_cf} == "html" || ${_cf} == "html.tar" || ${_cf} == "txt")
397 CLEANFILES+= ${LOCAL_CSS_SHEET}
400 .if !defined(WITH_INLINE_LEGALNOTICE) || empty(WITH_INLINE_LEGALNOTICE) && \
401 (${_cf} == "html-split" || ${_cf} == "html-split.tar" || \
402 ${_cf} == "html" || ${_cf} == "html.tar" || ${_cf} == "txt")
403 CLEANFILES+= LEGALNOTICE.html TRADEMARKS.html
406 .endfor # _curformat in ${FORMATS} #
410 # Build a list of install-${format}.${compress_format} targets to be
411 # by "make install". Also, add ${DOC}.${format}.${compress_format} to
412 # ${_docs} and ${CLEANFILES} so they get built/cleaned by "all" and
416 .if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED)
417 .for _curformat in ${FORMATS}
419 .for _curcomp in ${INSTALL_COMPRESSED}
421 .if ${_cf} != "html-split" && ${_cf} != "html"
422 _curinst+= install-${_curformat}.${_curcomp}
423 _docs+= ${DOC}.${_curformat}.${_curcomp}
424 CLEANFILES+= ${DOC}.${_curformat}.${_curcomp}
427 _docs+= ${.CURDIR:T}.${_curformat}.${_curcomp}
428 CLEANFILES+= ${.CURDIR:T}.${_curformat}.${_curcomp}
439 CLEANFILES+= ${INDEX_SGML}
441 .if defined(GEN_INDEX) && defined(HAS_INDEX)
442 JADEFLAGS+= -i chap.index
443 HTML_SPLIT_INDEX?= html-split.index
444 HTML_INDEX?= html.index
445 PRINT_INDEX?= print.index
446 INDEX_SGML?= index.sgml
448 CLEANFILES+= ${HTML_SPLIT_INDEX} ${HTML_INDEX} ${PRINT_INDEX}
455 # XML --------------------------------------------------------------------
457 # sx generates a lot of (spurious) errors of the form "reference to
458 # internal SDATA entity ...". So dump the errors to separate file, and
459 # grep for any other errors to show them to the user.
461 # Better approaches to handling this would be most welcome
463 .if !defined(CUSTOMIZED_XML)
465 echo '<!DOCTYPE book SYSTEM "/usr/pkg/share/xml/docbook/4.2/docbookx.dtd">' > ${DOC}.xml
466 ${SX} -xlower -xndata ${MASTERDOC} 2> .sxerr | tail -n +2 >> ${DOC}.xml
467 @-grep -v 'reference to internal SDATA entity' .sxerr
470 # HTML-SPLIT -------------------------------------------------------------
472 .if !defined(CUSTOMIZED_XML)
473 XSLTPROCFLAGS?= --nonet --param dragonfly.output.html.images "'1'"
478 .if ${STYLESHEET_TYPE} == "dsssl"
479 index.html HTML.manifest: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
480 ${LOCAL_IMAGES_TXT} ${INDEX_SGML} ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET}
481 ${JADE_CMD} -V html-manifest ${HTMLOPTS} -ioutput.html.images \
482 ${JADEOPTS} -t sgml ${MASTERDOC}
483 .elif ${STYLESHEET_TYPE} == "xsl"
484 index.html: ${DOC}.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
485 #${INDEX_SGML} ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET}
486 ${XSLTPROC} ${XSLTPROCOPTS} ${XSLTPROCFLAGS} ${XSLHTMLCHUNK} \
489 .if !defined(NO_TIDY)
490 -${TIDY} ${TIDYOPTS} $$(${XARGS} < HTML.manifest)
493 # HTML -------------------------------------------------------------------
495 .if ${STYLESHEET_TYPE} == "dsssl"
496 ${DOC}.html: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
497 ${LOCAL_IMAGES_TXT} ${INDEX_SGML} ${HTML_INDEX} ${LOCAL_CSS_SHEET}
498 ${JADE_CMD} -V nochunks ${HTMLOPTS} -ioutput.html.images \
499 ${JADEOPTS} -t sgml ${MASTERDOC} > ${.TARGET} || \
500 (${RM} -f ${.TARGET} && false)
501 .elif ${STYLESHEET_TYPE} == "xsl"
502 ${DOC}.html: ${DOC}.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
503 ${INDEX_SGML} ${LOCAL_CSS_SHEET}
504 ${XSLTPROC} ${XSLTPROCOPTS} ${XSLTPROCFLAGS} ${XSLHTML} \
505 ${DOC}.xml > ${.TARGET}
507 .if !defined(NO_TIDY)
508 -${TIDY} ${TIDYOPTS} ${.TARGET}
511 # HTML-TEXT --------------------------------------------------------------
513 # Special target to produce HTML with no images in it.
514 .if ${STYLESHEET_TYPE} == "dsssl"
515 ${DOC}.html-text: ${SRCS} ${INDEX_SGML} ${HTML_INDEX} ${LOCAL_IMAGES_TXT}
516 ${JADE_CMD} -V nochunks ${HTMLTXTOPTS} \
517 ${JADEOPTS} -t sgml ${MASTERDOC} > ${.TARGET} || \
518 (${RM} -f ${.TARGET} && false)
519 .elif ${STYLESHEET_TYPE} == "xsl"
520 ${DOC}.html-text: ${DOC}.xml ${INDEX_SGML} ${HTML_INDEX}
521 ${XSLTPROC} ${XSLTPROCOPTS} --param dragonfly.output.html.images "'0'" ${XSLHTML} \
522 ${DOC}.xml > ${.TARGET}
525 ${DOC}.html-split.tar: HTML.manifest ${LOCAL_IMAGES_LIB} \
526 ${LOCAL_IMAGES_PNG} ${LOCAL_CSS_SHEET}
527 ${TAR} cf ${.TARGET} $$(${XARGS} < HTML.manifest) \
528 ${LOCAL_IMAGES_LIB} ${IMAGES_PNG:N*share*} ${CSS_SHEET:T}
529 .for _curimage in ${IMAGES_PNG:M*share*}
530 ${TAR} rf ${.TARGET} -C ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} ${_curimage:S|${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T}/||}
533 ${DOC}.html.tar: ${DOC}.html ${LOCAL_IMAGES_LIB} \
534 ${LOCAL_IMAGES_PNG} ${LOCAL_CSS_SHEET}
535 ${TAR} cf ${.TARGET} ${DOC}.html \
536 ${LOCAL_IMAGES_LIB} ${IMAGES_PNG:N*share*} ${CSS_SHEET:T}
537 .for _curimage in ${IMAGES_PNG:M*share*}
538 ${TAR} rf ${.TARGET} -C ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} ${_curimage:S|${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T}/||}
541 # TXT --------------------------------------------------------------------
543 ${DOC}.txt: ${DOC}.html-text
544 ${HTML2TXT} ${HTML2TXTOPTS} ${.ALLSRC} > ${.TARGET}
546 # PDB --------------------------------------------------------------------
548 ${DOC}.pdb: ${DOC}.html ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG}
549 ${HTML2PDB} ${HTML2PDBOPTS} ${DOC}.html ${.TARGET}
551 ${.CURDIR:T}.pdb: ${DOC}.pdb
552 ${LN} -f ${.ALLSRC} ${.TARGET}
554 .if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED)
555 .for _curcomp in ${INSTALL_COMPRESSED}
556 ${.CURDIR:T}.pdb.${_curcomp}: ${DOC}.pdb.${_curcomp}
557 ${LN} -f ${.ALLSRC} ${.TARGET}
561 # RTF --------------------------------------------------------------------
563 ${DOC}.rtf: ${SRCS} ${LOCAL_IMAGES_EPS} ${LOCAL_IMAGES_TXT}
564 ${JADE_CMD} -V rtf-backend ${PRINTOPTS} -ioutput.rtf.images \
565 ${JADEOPTS} -t rtf -o ${.TARGET} ${MASTERDOC}
567 ${DOC}.rtf.tar: ${DOC}.rtf ${LOCAL_IMAGES_PNG}
568 ${TAR} cf ${.TARGET} ${DOC}.rtf ${IMAGES_PNG:N*share*}
569 .for _curimage in ${IMAGES_PNG:M*share*}
570 ${TAR} rf ${.TARGET} -C ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} \
571 ${_curimage:S|${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T}/||}
575 # This sucks, but there's no way round it. The PS and PDF formats need
576 # to use different image formats, which are chosen at the .tex stage. So,
577 # we need to create a different .tex file depending on our eventual output
578 # format, which will then lead on to a different .dvi file as well.
581 ${DOC}.tex: ${SRCS} ${LOCAL_IMAGES_EPS} ${INDEX_SGML} ${PRINT_INDEX} \
582 ${LOCAL_IMAGES_TXT} ${LOCAL_IMAGES_EN}
583 ${JADE_CMD} -V tex-backend ${PRINTOPTS} \
584 ${JADEOPTS} -t tex -o ${.TARGET} ${MASTERDOC}
586 ${DOC}.tex-ps: ${DOC}.tex
587 ${LN} -f ${.ALLSRC} ${.TARGET}
589 .if !target(${DOC}.tex-pdf)
590 ${DOC}.tex-pdf: ${SRCS} ${IMAGES_PDF} ${INDEX_SGML} ${PRINT_INDEX} \
593 ${CAT} ${PDFTEX_DEF} > ${.TARGET}
594 /bin/sh ${PDF_GENINFO} >> ${.TARGET}
595 ${JADE_CMD} -V tex-backend ${PRINTOPTS} -ioutput.print.pdf \
596 ${JADEOPTS} -t tex -o /dev/stdout ${MASTERDOC} >> ${.TARGET}
599 ${DOC}.dvi: ${DOC}.tex ${LOCAL_IMAGES_EPS}
600 .for _curimage in ${LOCAL_IMAGES_EPS:M*share*}
601 ${CP} -p ${_curimage} ${.CURDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||}
603 @${ECHO} "==> TeX pass 1/3"
604 -${JADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex}'
605 @${ECHO} "==> TeX pass 2/3"
606 -${JADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex}'
607 @${ECHO} "==> TeX pass 3/3"
608 -${JADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex}'
610 .if !target(${DOC}.pdf)
611 ${DOC}.pdf: ${DOC}.tex-pdf ${IMAGES_PDF}
612 .for _curimage in ${IMAGES_PDF:M*share*}
613 ${CP} -p ${_curimage} ${.CURDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||}
615 @${ECHO} "==> PDFTeX pass 1/3"
616 -${PDFJADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex-pdf}'
617 @${ECHO} "==> PDFTeX pass 2/3"
618 -${PDFJADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex-pdf}'
619 @${ECHO} "==> PDFTeX pass 3/3"
620 ${PDFJADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex-pdf}'
623 ${DOC}.ps: ${DOC}.dvi
624 ${DVIPS} ${DVIPSOPTS} -o ${.TARGET} ${.ALLSRC}
626 ${DOC}.tar: ${SRCS} ${LOCAL_IMAGES} ${LOCAL_CSS_SHEET}
627 ${TAR} cf ${.TARGET} -C ${.CURDIR} ${SRCS} \
628 -C ${.OBJDIR} ${IMAGES} ${CSS_SHEET:T}
631 # Build targets for any formats we've missed that we don't handle.
633 .for _curformat in ${ALL_FORMATS}
634 .if !target(${DOC}.${_curformat})
635 ${DOC}.${_curformat}:
636 @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document.
641 # ------------------------------------------------------------------------
647 # Lets you quickly check that the document conforms to the DTD without
648 # having to convert it to any other formats
652 ${NSGMLS} ${NSGMLSWARNINGS} -s ${NSGMLSFLAGS} ${SGMLFLAGS} ${CATALOGS} ${MASTERDOC}
655 # ------------------------------------------------------------------------
661 # Generate a different .index file based on the format name
663 # If we're not generating an index (the default) then we need to create
664 # an empty index.sgml file so that we can reference index.sgml in book.sgml
668 ${PERL} ${COLLATEINDEX} -N -o ${.TARGET}
671 ${JADE_CMD} -V html-index -V nochunks ${HTMLOPTS} -ioutput.html.images \
672 ${JADEOPTS} -t sgml ${MASTERDOC} > /dev/null
673 ${PERL} ${COLLATEINDEX} -g -o ${INDEX_SGML} ${.TARGET}
676 ${JADE_CMD} -V html-index ${HTMLOPTS} -ioutput.html.images \
677 ${JADEOPTS} -t sgml ${MASTERDOC} > /dev/null
678 ${PERL} ${COLLATEINDEX} -g -o ${INDEX_SGML} ${.TARGET}
680 ${PRINT_INDEX}: ${HTML_INDEX}
681 ${CP} -p ${HTML_INDEX} ${.TARGET}
684 # ------------------------------------------------------------------------
690 # The list of compression extensions this Makefile knows about. If you
691 # add new compression schemes, add to this list (which is a list of
692 # extensions, hence bz2, *not* bzip2) and extend the _PROG_COMPRESS_*
696 KNOWN_COMPRESS= gz bz2 zip
699 # You can't build suffix rules to do compression, since you can't
700 # wildcard the source suffix. So these are defined .USE, to be tacked on
701 # as dependencies of the compress-* targets.
704 _PROG_COMPRESS_gz: .USE
705 ${GZIP_CMD} < ${.ALLSRC} > ${.TARGET}
707 _PROG_COMPRESS_bz2: .USE
708 ${BZIP2_CMD} < ${.ALLSRC} > ${.TARGET}
710 _PROG_COMPRESS_zip: .USE
711 ${ZIP_CMD} ${.TARGET} ${.ALLSRC}
714 # Build a list of targets for each compression scheme and output format.
715 # Don't compress the html-split or html output format (because they need
716 # to be rolled in to tar files first).
718 .for _curformat in ${KNOWN_FORMATS}
720 .for _curcompress in ${KNOWN_COMPRESS}
721 .if ${_cf} == "html-split" || ${_cf} == "html"
722 ${DOC}.${_cf}.tar.${_curcompress}: ${DOC}.${_cf}.tar \
723 _PROG_COMPRESS_${_curcompress}
725 ${DOC}.${_cf}.${_curcompress}: ${DOC}.${_cf} _PROG_COMPRESS_${_curcompress}
731 # Build targets for any formats we've missed that we don't handle.
733 .for _curformat in ${ALL_FORMATS}
734 .for _curcompress in ${KNOWN_COMPRESS}
735 .if !target(${DOC}.${_curformat}.${_curcompress})
736 ${DOC}.${_curformat}.${_curcompress}:
737 @${ECHO_CMD} \"${_curformat}.${_curcompress}\" is not a valid output format for this document.
743 # ------------------------------------------------------------------------
747 # Build install-* targets, one per allowed value in FORMATS. Need to
748 # build two specific targets;
750 # install-html-split - Handles multiple .html files being generated
751 # from one source. Uses the HTML.manifest file
752 # created by the stylesheets, which should list
753 # each .html file that's been created.
755 # install-* - Every other format. The wildcard expands to
756 # the other allowed formats, all of which should
757 # generate just one file.
759 # "beforeinstall" and "afterinstall" are hooks in to this process.
760 # Redefine them to do things before and after the files are installed,
764 .if exists(HTML.manifest)
765 _html_docs!=${CAT} HTML.manifest
768 spellcheck-html-split: populate_html_docs
769 .for _html_file in ${_html_docs}
770 @echo "Spellcheck ${_html_file}"
771 @${HTML2TXT} ${HTML2TXTOPTS} ${.CURDIR}/${_html_file} | ${ISPELL} ${ISPELLOPTS}
774 .for _entry in ${_docs}
775 @echo "Spellcheck ${_entry}"
776 @${HTML2TXT} ${HTML2TXTOPTS} ${.CURDIR}/${_entry} | ${ISPELL} ${ISPELLOPTS}
779 .for _entry in ${_docs:M*.txt}
780 @echo "Spellcheck ${_entry}"
781 @ < ${.CURDIR}/${_entry} ${ISPELL} ${ISPELLOPTS}
783 .for _curformat in ${FORMATS}
784 .if !target(spellcheck-${_curformat})
785 spellcheck-${_curformat}:
786 @echo "Spellcheck is not currently supported for the ${_curformat} format."
790 spellcheck: ${FORMATS:C/^/spellcheck-/}
793 .for _entry in ${SRCS:M*.sgml}
794 @echo "indexreport ${_entry}"
795 @${PERL} ${INDEXREPORTSCRIPT} ${.CURDIR}/${_entry}
799 # Build a list of install-format targets to be installed. These will be
800 # dependencies for the "realinstall" target.
803 .if !defined(INSTALL_ONLY_COMPRESSED) || empty(INSTALL_ONLY_COMPRESSED)
804 _curinst+= ${FORMATS:S/^/install-/g}
807 realinstall: ${_curinst}
809 .for _curformat in ${KNOWN_FORMATS}
811 .if !target(install-${_cf})
812 .if ${_cf} == "html-split"
813 install-${_curformat}: index.html
815 install-${_curformat}: ${DOC}.${_curformat}
817 @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR}
818 .if ${_cf} == "html-split"
819 ${INSTALL_DOCS} $$(${XARGS} < HTML.manifest) ${DESTDIR}
821 ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR}
823 .if (${_cf} == "html-split" || ${_cf} == "html") && !empty(LOCAL_CSS_SHEET)
824 ${INSTALL_DOCS} ${LOCAL_CSS_SHEET} ${DESTDIR}
825 .if ${_cf} == "html-split"
826 @if [ -f ln*.html ]; then \
827 ${INSTALL_DOCS} ln*.html ${DESTDIR}; \
829 @if [ -f LEGALNOTICE.html ]; then \
830 ${INSTALL_DOCS} LEGALNOTICE.html ${DESTDIR}; \
832 @if [ -f TRADEMARKS.html ]; then \
833 ${INSTALL_DOCS} TRADEMARKS.html ${DESTDIR}; \
835 @if [ -f ${.OBJDIR}/${DOC}.ln ]; then \
836 cd ${DESTDIR}; sh ${.OBJDIR}/${DOC}.ln; \
839 .for _curimage in ${IMAGES_LIB}
840 @[ -d ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ] || \
841 ${MKDIR} -p ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H}
842 ${INSTALL_DOCS} ${LOCAL_IMAGES_LIB_DIR}/${_curimage} \
843 ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H}
845 # Install the images. First, loop over all the image names that contain a
846 # directory separator, make the subdirectories, and install. Then loop over
847 # the ones that don't contain a directory separator, and install them in the
849 # Install at first images from /usr/share/images then localized ones
850 # cause of a different origin path.
851 .for _curimage in ${IMAGES_PNG:M*/*:M*share*}
852 ${MKDIR} -p ${DESTDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||}
853 ${INSTALL_DOCS} ${_curimage} ${DESTDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||}
855 .for _curimage in ${IMAGES_PNG:M*/*:N*share*}
856 ${MKDIR} -p ${DESTDIR}/${_curimage:H}
857 ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage:H}
859 .for _curimage in ${IMAGES_PNG:N*/*}
860 ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage}
862 .elif ${_cf} == "tex" || ${_cf} == "dvi"
863 .for _curimage in ${IMAGES_EPS:M*/*}
864 ${MKDIR} -p ${DESTDIR}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR:T}/||}
865 ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR:T}/||}
867 .for _curimage in ${IMAGES_EPS:N*/*}
868 ${INSTALL_DOCS} ${_curimage} ${DESTDIR}
870 .elif ${_cf} == "pdb"
871 ${LN} -f ${DESTDIR}/${.ALLSRC} ${DESTDIR}/${.CURDIR:T}.${_curformat}
873 .elif ${_cf} == "rtf"
874 .for _curimage in ${IMAGES_PNG:M*/*:M*share*}
875 ${MKDIR} -p ${DESTDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||}
876 ${INSTALL_DOCS} ${_curimage} ${DESTDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||}
878 .for _curimage in ${IMAGES_PNG:M*/*:N*share*}
879 ${MKDIR} -p ${DESTDIR}/${_curimage:H}
880 ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage:H}
882 .for _curimage in ${IMAGES_PNG:N*/*}
883 ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage}
887 .if ${_cf} == "html-split"
888 .for _compressext in ${KNOWN_COMPRESS}
889 install-${_curformat}.tar.${_compressext}: ${DOC}.${_curformat}.tar.${_compressext}
890 @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR}
891 ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR}
894 .for _compressext in ${KNOWN_COMPRESS}
895 .if !target(install-${_curformat}.${_compressext})
896 install-${_curformat}.${_compressext}: ${DOC}.${_curformat}.${_compressext}
897 @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR}
898 ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR}
900 ${LN} -f ${DESTDIR}/${.ALLSRC} \
901 ${DESTDIR}/${.CURDIR:T}.${_curformat}.${_compressext}
910 # Build install- targets for any formats we've missed that we don't handle.
913 .for _curformat in ${ALL_FORMATS}
914 .if !target(install-${_curformat})
915 install-${_curformat}:
916 @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document.
918 .for _compressext in ${KNOWN_COMPRESS}
919 install-${_curformat}.${_compressext}:
920 @${ECHO_CMD} \"${_curformat}.${_compressext}\" is not a valid output format for this document.
926 # ------------------------------------------------------------------------
932 # realpackage is what is called in each subdirectory when a package
933 # target is called, or, rather, package calls realpackage in each
934 # subdirectory as it goes.
936 # packagelist returns the list of targets that would be called during
940 realpackage: ${FORMATS:S/^/package-/}
942 @${ECHO_CMD} ${FORMATS:S/^/package-/}
945 # Build a list of package targets for each output target. Each package
946 # target depends on the corresponding install target running.
949 .if defined(BZIP2_PACKAGE)
955 PKGDOCPFX!= realpath ${DOC_PREFIX}
957 .for _curformat in ${KNOWN_FORMATS}
959 ${PACKAGES}/${.CURDIR:T}.${LANGCODE}.${_curformat}.${PKG_SUFFIX}:
960 ${MKDIR} -p ${.OBJDIR}/pkg; \
962 ${MAKE} FORMATS=${_curformat} \
963 DOCDIR=${.OBJDIR}/pkg \
966 PKGSRCDIR=${.OBJDIR}/pkg/${.CURDIR:S/${PKGDOCPFX}\///}; \
967 /bin/ls -1 $$PKGSRCDIR > ${.OBJDIR}/PLIST.${_curformat}; \
968 ${PKG_CREATE} -v -f ${.OBJDIR}/PLIST.${_curformat} \
969 -p ${DESTDIR} -s $$PKGSRCDIR \
970 -c -"FDP ${.CURDIR:T} ${_curformat} package" \
971 -d -"FDP ${.CURDIR:T} ${_curformat} package" ${.TARGET} || \
972 (${RM} -fr ${.TARGET} PLIST.${_curformat} && false); \
973 ${RM} -rf ${.OBJDIR}/pkg
975 package-${_curformat}: ${PACKAGES}/${.CURDIR:T}.${LANGCODE}.${_curformat}.${PKG_SUFFIX}
978 .if ${LOCAL_CSS_SHEET} != ${CSS_SHEET}
979 ${LOCAL_CSS_SHEET}: ${CSS_SHEET}
981 ${CAT} ${.ALLSRC} > ${.TARGET}
982 .if defined(CSS_SHEET_ADDITIONS)
983 ${CAT} ${.CURDIR}/${CSS_SHEET_ADDITIONS} >> ${.TARGET}