diff --git a/share/mk/doc.docbook.mk b/share/mk/doc.docbook.mk index dd5b69d855..1117c206d3 100644 --- a/share/mk/doc.docbook.mk +++ b/share/mk/doc.docbook.mk @@ -1,727 +1,727 @@ # # $FreeBSD$ # # This include file handles building and installing of # DocBook documentation in the FreeBSD Documentation Project. # # Documentation using DOCFORMAT=docbook is expected to be marked up # according to the DocBook DTD # # ------------------------------------------------------------------------ # # Document-specific variables # # DOC This should be set to the name of the DocBook # marked-up file, without the .sgml or .docb suffix. # # It also determins the name of the output files - # ${DOC}.html. # # DOCBOOKSUFFIX The suffix of your document, defaulting to .sgml # # SRCS The names of all the files that are needed to # build this document - This is useful if any of # them need to be generated. Changing any file in # SRCS causes the documents to be rebuilt. # # ------------------------------------------------------------------------ # # Variables used by both users and documents: # # SGMLFLAGS Additional options to pass to various SGML # processors (e.g., jade, nsgmls). Typically # used to define "IGNORE" entities to "INCLUDE" # with "-i" # # JADEFLAGS Additional options to pass to Jade. Typically # used to set additional variables, such as # "%generate-article-toc%". # # TIDYFLAGS Additional flags to pass to Tidy. Typically # used to set "-raw" flag to handle 8bit characters. # # EXTRA_CATALOGS Additional catalog files that should be used by # any SGML processing applications. # # NO_TIDY If you do not want to use tidy, set this to "YES". # # GEN_INDEX If defined, index.sgml will be added to the list # of dependencies for source files, and collateindex.pl # will be run to generate index.sgml. # # CSS_SHEET Full path to a CSS stylesheet suitable for DocBook. # Default is ${DOC_PREFIX}/share/misc/docbook.css # # Print-output options : # # NICE_HEADERS If defined, customized chapter headers will be created # that you may find more aesthetically pleasing. Note # that this option only effects print output formats for # Enlish language books. # # MIN_SECT_LABELS If defined, do not display the section number for 4th # and 5th level section titles. This would change # "N.N.N.N Section title" into "Section Title" while # higher level sections are still printed with numbers. # # TRACE={1,2} Trace TeX's memory usage. Set this to 1 for minimal # tracing or 2 for maximum tracing. TeX memory # statistics will be written out to .log. # For more information see the TeXbook, p301. # # TWO_SIDE If defined, two sided output will be created. This # means that new chapters will only start on odd # numbered (aka right side, aka recto) pages and the # headers and footers will be aligned appropriately # for double sided paper. Blank pages may be added as # needed. # # JUSTIFY If defined, text will be right justified so that the # right edge is smooth. Words may be hyphenated using # the defalt TeX hyphenation rules for this purpose. # # BOOK_OUTPUT A collection of options are set suitable for printing # a book. This option may be an order of magnitude more # CPU intensive than the default build. # # # Documents should use the += format to access these. # DOCBOOKSUFFIX?= sgml MASTERDOC?= ${.CURDIR}/${DOC}.${DOCBOOKSUFFIX} .if ${MACHINE_ARCH} == "alpha" OPENJADE= yes .endif .if defined(OPENJADE) JADE?= ${PREFIX}/bin/openjade JADECATALOG?= ${PREFIX}/share/sgml/openjade/catalog NSGMLS?= ${PREFIX}/bin/onsgmls JADEFLAGS+= -V openjade .else JADE?= ${PREFIX}/bin/jade JADECATALOG?= ${PREFIX}/share/sgml/jade/catalog NSGMLS?= ${PREFIX}/bin/nsgmls .endif DSLHTML?= ${DOC_PREFIX}/share/sgml/default.dsl DSLPRINT?= ${DOC_PREFIX}/share/sgml/default.dsl DSLPGP?= ${DOC_PREFIX}/share/sgml/pgp.dsl FREEBSDCATALOG= ${DOC_PREFIX}/share/sgml/catalog LANGUAGECATALOG=${DOC_PREFIX}/${LANGCODE}/share/sgml/catalog DOCBOOKCATALOG= ${PREFIX}/share/sgml/docbook/catalog DSSSLCATALOG= ${PREFIX}/share/sgml/docbook/dsssl/modular/catalog COLLATEINDEX= ${PREFIX}/share/sgml/docbook/dsssl/modular/bin/collateindex.pl IMAGES_LIB?= CATALOGS= -c ${LANGUAGECATALOG} -c ${FREEBSDCATALOG} \ -c ${DSSSLCATALOG} -c ${DOCBOOKCATALOG} \ -c ${JADECATALOG} ${EXTRA_CATALOGS:S/^/-c /g} SGMLFLAGS+= -D ${CANONICALOBJDIR} JADEOPTS= ${JADEFLAGS} ${SGMLFLAGS} ${CATALOGS} KNOWN_FORMATS= html html.tar html-split html-split.tar \ txt rtf ps pdf tex dvi tar pdb CSS_SHEET?= ${DOC_PREFIX}/share/misc/docbook.css PDFTEX_DEF?= ${DOC_PREFIX}/share/web2c/pdftex.def HTMLOPTS?= -ioutput.html -d ${DSLHTML} ${HTMLFLAGS} PRINTOPTS?= -ioutput.print -d ${DSLPRINT} ${PRINTFLAGS} .if defined(BOOK_OUTPUT) NICE_HEADERS=1 MIN_SECT_LABELS=1 TWO_SIDE=1 JUSTIFY=1 #WITH_FOOTNOTES=1 #GEN_INDEX=1 .endif .if defined(JUSTIFY) TEXCMDS+= \RequirePackage{url} PRINTOPTS+= -ioutput.print.justify .endif .if defined(TWO_SIDE) PRINTOPTS+= -V %two-side% -ioutput.print.twoside TEXCMDS+= \def\PageTwoSide{1} .endif .if defined(NICE_HEADERS) PRINTOPTS+= -ioutput.print.niceheaders .endif .if defined(MIN_SECT_LABELS) PRINTOPTS+= -V minimal-section-labels .endif .if defined(TRACE) TEXCMDS+= \tracingstats=${TRACE} .endif PERL?= /usr/bin/perl PKG_CREATE?= /usr/sbin/pkg_create SORT?= /usr/bin/sort TAR?= /usr/bin/tar TOUCH?= /usr/bin/touch XARGS?= /usr/bin/xargs TEX?= ${PREFIX}/bin/tex PDFTEX?= ${PREFIX}/bin/pdftex TIDY?= ${PREFIX}/bin/tidy -TIDYFLAGS?= -i -m -f /dev/null +TIDYOPTS?= -i -m -f /dev/null ${TYDYFLAGS} HTML2TXT?= ${PREFIX}/bin/links -HTML2TXTFLAGS?= -dump +HTML2TXTOPTS?= -dump ${HTML2TXTFLAGS} HTML2PDB?= ${PREFIX}/bin/iSiloBSD -HTML2PDBFLAGS?= -y -d0 -Idef +HTML2PDBOPTS?= -y -d0 -Idef ${HTML2PDBFLAGS} DVIPS?= ${PREFIX}/bin/dvips .if defined(PAPERSIZE) -DVIPSFLAGS?= -t ${PAPERSIZE:L} +DVIPSOPTS?= -t ${PAPERSIZE:L} ${DVIPSFLAGS} .endif GZIP?= -9 GZIP_CMD?= gzip -qf ${GZIP} BZIP2?= -9 BZIP2_CMD?= bzip2 -qf ${BZIP2} ZIP?= -9 ZIP_CMD?= ${PREFIX}/bin/zip -j ${ZIP} # ------------------------------------------------------------------------ # # Look at ${FORMATS} and work out which documents need to be generated. # It is assumed that the HTML transformation will always create a file # called index.html, and that for every other transformation the name # of the generated file is ${DOC}.format. # # ${_docs} will be set to a list of all documents that must be made # up to date. # # ${CLEANFILES} is a list of files that should be removed by the "clean" # target. ${COMPRESS_EXT:S/^/${DOC}.${_cf}.&/ takes the COMPRESS_EXT # var, and prepends the filename to each listed extension, building a # second list of files with the compressed extensions added. # # Note: ".for _curformat in ${KNOWN_FORMATS}" is used several times in # this file. I know they could have been rolled together in to one, much # larger, loop. However, that would have made things more complicated # for a newcomer to this file to unravel and understand, and a syntax # error in the loop would have affected the entire # build/compress/install process, instead of just one of them, making it # more difficult to debug. # # Note: It is the aim of this file that *all* the targets be available, # not just those appropriate to the current ${FORMATS} and # ${INSTALL_COMPRESSED} values. # # For example, if FORMATS=html and INSTALL_COMPRESSED=gz you could still # type # # make book.rtf.bz2 # # and it will do the right thing. Or # # make install-rtf.bz2 # # for that matter. But don't expect "make clean" to work if the FORMATS # and INSTALL_COMPRESSED variables are wrong. # .if ${.OBJDIR} != ${.CURDIR} LOCAL_CSS_SHEET= ${.OBJDIR}/${CSS_SHEET:T} .else LOCAL_CSS_SHEET= ${CSS_SHEET:T} .endif .for _curformat in ${FORMATS} _cf=${_curformat} .if ${_cf} == "html-split" _docs+= index.html HTML.manifest ln*.html CLEANFILES+= $$([ -f HTML.manifest ] && ${XARGS} < HTML.manifest) \ HTML.manifest ln*.html CLEANFILES+= PLIST.${_curformat} .else _docs+= ${DOC}.${_curformat} CLEANFILES+= ${DOC}.${_curformat} CLEANFILES+= PLIST.${_curformat} .if ${_cf} == "html-split.tar" CLEANFILES+= $$([ -f HTML.manifest ] && ${XARGS} < HTML.manifest) \ HTML.manifest ln*.html .elif ${_cf} == "html.tar" CLEANFILES+= ${DOC}.html .elif ${_cf} == "txt" CLEANFILES+= ${DOC}.html-text .elif ${_cf} == "dvi" CLEANFILES+= ${DOC}.aux ${DOC}.log ${DOC}.tex .elif ${_cf} == "tex" CLEANFILES+= ${DOC}.aux ${DOC}.log .elif ${_cf} == "ps" CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.tex-ps .elif ${_cf} == "pdf" CLEANFILES+= ${DOC}.aux ${DOC}.dvi ${DOC}.log ${DOC}.out ${DOC}.tex-pdf .elif ${_cf} == "pdb" _docs+= ${.CURDIR:T}.pdb CLEANFILES+= ${.CURDIR:T}.pdb .endif .endif .if (${LOCAL_CSS_SHEET} != ${CSS_SHEET}) && \ (${_cf} == "html-split" || ${_cf} == "html-split.tar" || \ ${_cf} == "html" || ${_cf} == "html.tar" || ${_cf} == "txt") CLEANFILES+= ${LOCAL_CSS_SHEET} .endif .endfor # # Build a list of install-${format}.${compress_format} targets to be # by "make install". Also, add ${DOC}.${format}.${compress_format} to # ${_docs} and ${CLEANFILES} so they get built/cleaned by "all" and # "clean". # .if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED) .for _curformat in ${FORMATS} _cf=${_curformat} .for _curcomp in ${INSTALL_COMPRESSED} .if ${_cf} != "html-split" && ${_cf} != "html" _curinst+= install-${_curformat}.${_curcomp} _docs+= ${DOC}.${_curformat}.${_curcomp} CLEANFILES+= ${DOC}.${_curformat}.${_curcomp} .if ${_cf} == "pdb" _docs+= ${.CURDIR:T}.${_curformat}.${_curcomp} CLEANFILES+= ${.CURDIR:T}.${_curformat}.${_curcomp} .endif .endif .endfor .endfor .endif # # Index generation # INDEX_SGML?= index.sgml CLEANFILES+= ${INDEX_SGML} .if defined(GEN_INDEX) JADEFLAGS+= -i chap.index HTML_SPLIT_INDEX?= html-split.index HTML_INDEX?= html.index PRINT_INDEX?= print.index CLEANFILES+= ${HTML_SPLIT_INDEX} ${HTML_INDEX} ${PRINT_INDEX} .endif .MAIN: all all: ${_docs} index.html HTML.manifest: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ ${INDEX_SGML} ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET} ${JADE} -V html-manifest ${HTMLOPTS} -ioutput.html.images \ ${JADEOPTS} -t sgml ${MASTERDOC} .if !defined(NO_TIDY) - -${TIDY} ${TIDYFLAGS} $$(${XARGS} < HTML.manifest) + -${TIDY} ${TIDYOPTS} $$(${XARGS} < HTML.manifest) .endif ${DOC}.html: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ ${INDEX_SGML} ${HTML_INDEX} ${LOCAL_CSS_SHEET} ${JADE} -V nochunks ${HTMLOPTS} -ioutput.html.images \ ${JADEOPTS} -t sgml ${MASTERDOC} > ${.TARGET} || \ (${RM} -f ${.TARGET} && false) .if !defined(NO_TIDY) - -${TIDY} ${TIDYFLAGS} ${.TARGET} + -${TIDY} ${TIDYOPTS} ${.TARGET} .endif # Special target to produce HTML with no images in it. ${DOC}.html-text: ${SRCS} ${INDEX_SGML} ${HTML_INDEX} ${JADE} -V nochunks ${HTMLOPTS} \ ${JADEOPTS} -t sgml ${MASTERDOC} > ${.TARGET} || \ (${RM} -f ${.TARGET} && false) ${DOC}.html-split.tar: HTML.manifest ${LOCAL_IMAGES_LIB} \ ${LOCAL_IMAGES_PNG} ${LOCAL_CSS_SHEET} ${TAR} cf ${.TARGET} $$(${XARGS} < HTML.manifest) \ ${LOCAL_IMAGES_LIB} ${IMAGES_PNG} ${CSS_SHEET:T} ${DOC}.html.tar: ${DOC}.html ${LOCAL_IMAGES_LIB} \ ${LOCAL_IMAGES_PNG} ${LOCAL_CSS_SHEET} ${TAR} cf ${.TARGET} ${DOC}.html \ ${LOCAL_IMAGES_LIB} ${IMAGES_PNG} ${CSS_SHEET:T} ${DOC}.txt: ${DOC}.html-text - ${HTML2TXT} ${HTML2TXTFLAGS} ${.ALLSRC} > ${.TARGET} + ${HTML2TXT} ${HTML2TXTOPTS} ${.ALLSRC} > ${.TARGET} ${DOC}.pdb: ${DOC}.html ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} - ${HTML2PDB} ${HTML2PDBFLAGS} ${DOC}.html ${.TARGET} + ${HTML2PDB} ${HTML2PDBOPTS} ${DOC}.html ${.TARGET} ${.CURDIR:T}.pdb: ${DOC}.pdb ${LN} -f ${.ALLSRC} ${.TARGET} .if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED) .for _curcomp in ${INSTALL_COMPRESSED} ${.CURDIR:T}.pdb.${_curcomp}: ${DOC}.pdb.${_curcomp} ${LN} -f ${.ALLSRC} ${.TARGET} .endfor .endif ${DOC}.rtf: ${SRCS} ${LOCAL_IMAGES_EPS} ${JADE} -V rtf-backend ${PRINTOPTS} \ ${JADEOPTS} -t rtf -o ${.TARGET} ${MASTERDOC} # # This sucks, but there's no way round it. The PS and PDF formats need # to use different image formats, which are chosen at the .tex stage. So, # we need to create a different .tex file depending on our eventual output # format, which will then lead on to a different .dvi file as well. # ${DOC}.tex: ${SRCS} ${LOCAL_IMAGES_EPS} ${INDEX_SGML} ${PRINT_INDEX} ${JADE} -V tex-backend ${PRINTOPTS} \ ${JADEOPTS} -t tex -o ${.TARGET} ${MASTERDOC} ${DOC}.tex-ps: ${DOC}.tex ${LN} -f ${.ALLSRC} ${.TARGET} ${DOC}.tex-pdf: ${SRCS} ${IMAGES_PDF} ${INDEX_SGML} ${PRINT_INDEX} ${CP} -p ${PDFTEX_DEF} ${.TARGET} ${JADE} -V tex-backend ${PRINTOPTS} -ioutput.print.pdf \ ${JADEOPTS} -t tex -o /dev/stdout ${MASTERDOC} >> ${.TARGET} ${DOC}.dvi: ${DOC}.tex ${LOCAL_IMAGES_EPS} @${ECHO} "==> TeX pass 1/3" -${TEX} "&jadetex" '${TEXCMDS} \nonstopmode\input{${DOC}.tex}' @${ECHO} "==> TeX pass 2/3" -${TEX} "&jadetex" '${TEXCMDS} \nonstopmode\input{${DOC}.tex}' @${ECHO} "==> TeX pass 3/3" -${TEX} "&jadetex" '${TEXCMDS} \nonstopmode\input{${DOC}.tex}' ${DOC}.pdf: ${DOC}.tex-pdf ${IMAGES_PDF} @${ECHO} "==> PDFTeX pass 1/3" -${PDFTEX} "&pdfjadetex" '\nonstopmode\input{${DOC}.tex-pdf}' @${ECHO} "==> PDFTeX pass 2/3" -${PDFTEX} "&pdfjadetex" '\nonstopmode\input{${DOC}.tex-pdf}' @${ECHO} "==> PDFTeX pass 3/3" ${PDFTEX} "&pdfjadetex" '\nonstopmode\input{${DOC}.tex-pdf}' ${DOC}.ps: ${DOC}.dvi - ${DVIPS} -o ${.TARGET} ${.ALLSRC} + ${DVIPS} ${DVIPSOPTS} -o ${.TARGET} ${.ALLSRC} ${DOC}.tar: ${SRCS} ${LOCAL_IMAGES} ${LOCAL_CSS_SHEET} ${TAR} cf ${.TARGET} -C ${.CURDIR} ${SRCS} \ -C ${.OBJDIR} ${IMAGES} ${CSS_SHEET:T} # # Build targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .if !target(${DOC}.${_curformat}) ${DOC}.${_curformat}: @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document. .endif .endfor # ------------------------------------------------------------------------ # # Validation targets # # # Lets you quickly check that the document conforms to the DTD without # having to convert it to any other formats # lint validate: ${NSGMLS} -s ${SGMLFLAGS} ${CATALOGS} ${MASTERDOC} # ------------------------------------------------------------------------ # # Index targets # # # Generate a different .index file based on the format name # # If we're not generating an index (the default) then we need to create # an empty index.sgml file so that we can reference index.sgml in book.sgml # .if defined(GEN_INDEX) ${INDEX_SGML}: ${PERL} ${COLLATEINDEX} -N -o ${.TARGET} .else ${INDEX_SGML}: ${TOUCH} ${.TARGET} .endif ${HTML_INDEX}: ${JADE} -V html-index -V nochunks ${HTMLOPTS} -ioutput.html.images \ ${JADEOPTS} -t sgml ${MASTERDOC} > /dev/null ${PERL} ${COLLATEINDEX} -g -o ${INDEX_SGML} ${.TARGET} ${HTML_SPLIT_INDEX}: ${JADE} -V html-index ${HTMLOPTS} -ioutput.html.images \ ${JADEOPTS} -t sgml ${MASTERDOC} > /dev/null ${PERL} ${COLLATEINDEX} -g -o ${INDEX_SGML} ${.TARGET} ${PRINT_INDEX}: ${HTML_INDEX} ${CP} -p ${HTML_INDEX} ${.TARGET} # ------------------------------------------------------------------------ # # Compress targets # # # The list of compression extensions this Makefile knows about. If you # add new compression schemes, add to this list (which is a list of # extensions, hence bz2, *not* bzip2) and extend the _PROG_COMPRESS_* # targets. # KNOWN_COMPRESS= gz bz2 zip # # You can't build suffix rules to do compression, since you can't # wildcard the source suffix. So these are defined .USE, to be tacked on # as dependencies of the compress-* targets. # _PROG_COMPRESS_gz: .USE ${GZIP_CMD} < ${.ALLSRC} > ${.TARGET} _PROG_COMPRESS_bz2: .USE ${BZIP2_CMD} < ${.ALLSRC} > ${.TARGET} _PROG_COMPRESS_zip: .USE ${ZIP_CMD} ${.TARGET} ${.ALLSRC} # # Build a list of targets for each compression scheme and output format. # Don't compress the html-split or html output format (because they need # to be rolled in to tar files first). # .for _curformat in ${KNOWN_FORMATS} _cf=${_curformat} .for _curcompress in ${KNOWN_COMPRESS} .if ${_cf} == "html-split" || ${_cf} == "html" ${DOC}.${_cf}.tar.${_curcompress}: ${DOC}.${_cf}.tar \ _PROG_COMPRESS_${_curcompress} .else ${DOC}.${_cf}.${_curcompress}: ${DOC}.${_cf} _PROG_COMPRESS_${_curcompress} .endif .endfor .endfor # # Build targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .for _curcompress in ${KNOWN_COMPRESS} .if !target(${DOC}.${_curformat}.${_curcompress}) ${DOC}.${_curformat}.${_curcompress}: @${ECHO_CMD} \"${_curformat}.${_curcompress}\" is not a valid output format for this document. .endif .endfor .endfor # ------------------------------------------------------------------------ # # Install targets # # Build install-* targets, one per allowed value in FORMATS. Need to # build two specific targets; # # install-html-split - Handles multiple .html files being generated # from one source. Uses the HTML.manifest file # created by the stylesheets, which should list # each .html file that's been created. # # install-* - Every other format. The wildcard expands to # the other allowed formats, all of which should # generate just one file. # # "beforeinstall" and "afterinstall" are hooks in to this process. # Redefine them to do things before and after the files are installed, # respectively. # # Build a list of install-format targets to be installed. These will be # dependencies for the "realinstall" target. # .if !defined(INSTALL_ONLY_COMPRESSED) || empty(INSTALL_ONLY_COMPRESSED) _curinst+= ${FORMATS:S/^/install-/g} .endif realinstall: ${_curinst} .for _curformat in ${KNOWN_FORMATS} _cf=${_curformat} .if !target(install-${_cf}) .if ${_cf} == "html-split" install-${_curformat}: index.html .else install-${_curformat}: ${DOC}.${_curformat} .endif @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR} .if ${_cf} == "html-split" ${INSTALL_DOCS} $$(${XARGS} < HTML.manifest) ${DESTDIR} .else ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR} .endif .if (${_cf} == "html-split" || ${_cf} == "html") && !empty(LOCAL_CSS_SHEET) ${INSTALL_DOCS} ${LOCAL_CSS_SHEET} ${DESTDIR} .if ${_cf} == "html-split" @if [ -f ln*.html ]; then \ ${INSTALL_DOCS} ln*.html ${DESTDIR}; \ fi @if [ -f ${.OBJDIR}/${DOC}.ln ]; then \ cd ${DESTDIR}; sh ${.OBJDIR}/${DOC}.ln; \ fi .endif .for _curimage in ${IMAGES_LIB} @[ -d ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ] || \ ${MKDIR} -p ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ${INSTALL_DOCS} ${LOCAL_IMAGES_LIB_DIR}/${_curimage} \ ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} .endfor # Install the images. First, loop over all the image names that contain a # directory seperator, make the subdirectories, and install. Then loop over # the ones that don't contain a directory separator, and install them in the # top level. .for _curimage in ${IMAGES_PNG:M*/*} ${MKDIR} -p ${DESTDIR}/${_curimage:H} ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage:H} .endfor .for _curimage in ${IMAGES_PNG:N*/*} ${INSTALL_DOCS} ${_curimage} ${DESTDIR} .endfor .elif ${_cf} == "tex" || ${_cf} == "dvi" .for _curimage in ${IMAGES_EPS:M*/*} ${MKDIR} -p ${DESTDIR}/${_curimage:H} ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage:H} .endfor .for _curimage in ${IMAGES_EPS:N*/*} ${INSTALL_DOCS} ${_curimage} ${DESTDIR} .endfor .elif ${_cf} == "pdb" ${LN} -f ${DESTDIR}/${.ALLSRC} ${DESTDIR}/${.CURDIR:T}.${_curformat} .endif .if ${_cf} == "html-split" .for _compressext in ${KNOWN_COMPRESS} install-${_curformat}.tar.${_compressext}: ${DOC}.${_curformat}.tar.${_compressext} @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR} ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR} .endfor .else .for _compressext in ${KNOWN_COMPRESS} install-${_curformat}.${_compressext}: ${DOC}.${_curformat}.${_compressext} @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR} ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR} .if ${_cf} == "pdb" ${LN} -f ${DESTDIR}/${.ALLSRC} \ ${DESTDIR}/${.CURDIR:T}.${_curformat}.${_compressext} .endif .endfor .endif .endif .endfor # # Build install- targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .if !target(install-${_curformat}) install-${_curformat}: @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document. .for _compressext in ${KNOWN_COMPRESS} install-${_curformat}.${_compressext}: @${ECHO_CMD} \"${_curformat}.${_compressext}\" is not a valid output format for this document. .endfor .endif .endfor # ------------------------------------------------------------------------ # # Package building # # # realpackage is what is called in each subdirectory when a package # target is called, or, rather, package calls realpackage in each # subdirectory as it goes. # # packagelist returns the list of targets that would be called during # package building. # realpackage: ${FORMATS:S/^/package-/} packagelist: @${ECHO_CMD} ${FORMATS:S/^/package-/} # # Build a list of package targets for each output target. Each package # target depends on the corresponding install target running. # .for _curformat in ${KNOWN_FORMATS} _cf=${_curformat} .if ${_cf} == "html-split" PLIST.${_curformat}: index.html @${SORT} HTML.manifest > PLIST.${_curformat} .else PLIST.${_curformat}: ${DOC}.${_curformat} @${ECHO_CMD} ${DOC}.${_curformat} > PLIST.${_curformat} .endif .if (${_cf} == "html-split" || ${_cf} == "html") && \ (!empty(LOCAL_IMAGES_LIB) || !empty(IMAGES_PNG) || !empty(CSS_SHEET)) @${ECHO_CMD} ${LOCAL_IMAGES_LIB} ${IMAGES_PNG} ${LOCAL_CSS_SHEET} | \ ${XARGS} -n1 >> PLIST.${_curformat} .elif (${_cf} == "tex" || ${_cf} == "dvi") && !empty(IMAGES_EPS) @${ECHO_CMD} ${IMAGES_EPS} | ${XARGS} -n1 >> PLIST.${_curformat} .elif ${_cf} == "pdb" @${ECHO_CMD} ${.CURDIR:T}.${_curformat} >> PLIST.${_curformat} .endif ${PACKAGES}/${.CURDIR:T}.${LANGCODE}.${_curformat}.tgz: PLIST.${_cf} @${PKG_CREATE} -v -f ${.ALLSRC} -p ${DESTDIR} -s ${.OBJDIR} \ -c -"FDP ${.CURDIR:T} ${_curformat} package" \ -d -"FDP ${.CURDIR:T} ${_curformat} package" ${.TARGET} package-${_curformat}: ${PACKAGES}/${.CURDIR:T}.${LANGCODE}.${_curformat}.tgz .endfor .if ${LOCAL_CSS_SHEET} != ${CSS_SHEET} ${LOCAL_CSS_SHEET}: ${CSS_SHEET} ${CP} -p ${.ALLSRC} ${.TARGET} .endif diff --git a/share/mk/doc.html.mk b/share/mk/doc.html.mk index b89d7e1ab4..d2a715a4a2 100644 --- a/share/mk/doc.html.mk +++ b/share/mk/doc.html.mk @@ -1,387 +1,387 @@ # # $FreeBSD$ # # This include file handles building and installing of # HTML documentation in the FreeBSD Documentation Project. # # Documentation using DOCFORMAT=html is expected to be marked up # according to the HTML DTD # # ------------------------------------------------------------------------ # # Document-specific variables # # DOC This should be set to the name of the HTML # marked-up file, without the .sgml or .docb suffix. # # It also determins the name of the output files - # ${DOC}.html. # # DOCBOOKSUFFIX The suffix of your document, defaulting to .sgml # # SRCS The names of all the files that are needed to # build this document - This is useful if any of # them need to be generated. Changing any file in # SRCS causes the documents to be rebuilt. # # ------------------------------------------------------------------------ # # Variables used by both users and documents: # # TIDYFLAGS Additional flags to pass to Tidy. Typically # used to set "-raw" flag to handle 8bit characters. # # EXTRA_CATALOGS Additional catalog files that should be used by # any SGML processing applications. # # NO_TIDY If you do not want to use tidy, set this to "YES". # # Documents should use the += format to access these. # MASTERDOC?= ${.CURDIR}/${DOC}.sgml KNOWN_FORMATS= html txt tar pdb CSS_SHEET?= HTMLCATALOG= ${PREFIX}/share/sgml/html/catalog IMAGES_LIB?= .if ${MACHINE_ARCH} == "alpha" OPENJADE= yes .endif .if defined(OPENJADE) NSGMLS?= ${PREFIX}/bin/onsgmls SGMLNORM?= ${PREFIX}/bin/osgmlnorm .else NSGMLS?= ${PREFIX}/bin/nsgmls SGMLNORM?= ${PREFIX}/bin/sgmlnorm .endif PKG_CREATE?= /usr/sbin/pkg_create TAR?= /usr/bin/tar XARGS?= /usr/bin/xargs TIDY?= ${PREFIX}/bin/tidy -TIDYFLAGS?= -i -m -f /dev/null +TIDYOPTS?= -i -m -f /dev/null ${TIDYFLAGS} HTML2TXT?= ${PREFIX}/bin/links -HTML2TXTFLAGS?= -dump +HTML2TXTOPTS?= -dump ${HTML2TXTFLAGS} HTML2PDB?= ${PREFIX}/bin/iSiloBSD -HTML2PDBFLAGS?= -y -d0 -Idef +HTML2PDBOPTS?= -y -d0 -Idef ${HTML2PDBFLAGS} GZIP?= -9 GZIP_CMD?= gzip -qf ${GZIP} BZIP2?= -9 BZIP2_CMD?= bzip2 -qf ${BZIP2} ZIP?= -9 ZIP_CMD?= ${PREFIX}/bin/zip -j ${ZIP} # ------------------------------------------------------------------------ # .if ${.OBJDIR} != ${.CURDIR} LOCAL_CSS_SHEET= ${.OBJDIR}/${CSS_SHEET:T} .else LOCAL_CSS_SHEET= ${CSS_SHEET:T} .endif .for _curformat in ${FORMATS} _cf=${_curformat} # Create a 'bogus' doc for any format we support or not. This is so # that we can fake up a target for it later on, and this target can print # the warning message about the unsupported format. _docs+= ${DOC}.${_curformat} CLEANFILES+= ${DOC}.${_curformat} CLEANFILES+= PLIST.${_curformat} .if ${_cf} == "txt" .if ${LOCAL_CSS_SHEET} != ${CSS_SHEET} CLEANFILES+= ${LOCAL_CSS_SHEET} .endif .elif ${_cf} == "txt" CLEANFILES+= ${DOC}.html .elif ${_cf} == "pdb" _docs+= ${.CURDIR:T}.pdb CLEANFILES+= ${.CURDIR:T}.pdb .endif .endfor # # Build a list of install-${format}.${compress_format} targets to be # by "make install". Also, add ${DOC}.${format}.${compress_format} to # ${_docs} and ${CLEANFILES} so they get built/cleaned by "all" and # "clean". # .if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED) .for _curformat in ${FORMATS} _cf=${_curformat} .for _curcomp in ${INSTALL_COMPRESSED} .if ${_cf} != "html-split" _curinst+= install-${_curformat}.${_curcomp} _docs+= ${DOC}.${_curformat}.${_curcomp} CLEANFILES+= ${DOC}.${_curformat}.${_curcomp} .if ${_cf} == "pdb" _docs+= ${.CURDIR:T}.${_curformat}.${_curcomp} CLEANFILES+= ${.CURDIR:T}.${_curformat}.${_curcomp} .endif .endif .endfor .endfor .endif .MAIN: all all: ${_docs} ${DOC}.html: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} ${LOCAL_CSS_SHEET} ${SGMLNORM} -c ${HTMLCATALOG} ${SRCS:S|^|${.CURDIR}/|} > ${.TARGET} .if !defined(NO_TIDY) - -${TIDY} ${TIDYFLAGS} ${.TARGET} + -${TIDY} ${TIDYOPTS} ${.TARGET} .endif ${DOC}.txt: ${DOC}.html - ${HTML2TXT} ${HTML2TXTFLAGS} ${.ALLSRC} > ${.TARGET} + ${HTML2TXT} ${HTML2TXTOPTS} ${.ALLSRC} > ${.TARGET} ${DOC}.pdb: ${DOC}.html ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} - ${HTML2PDB} ${HTML2PDBFLAGS} ${DOC}.html ${.TARGET} + ${HTML2PDB} ${HTML2PDBOPTS} ${DOC}.html ${.TARGET} ${.CURDIR:T}.pdb: ${DOC}.pdb ${LN} -f ${.ALLSRC} ${.TARGET} .if defined(INSTALL_COMPRESSED) && !empty(INSTALL_COMPRESSED) .for _curcomp in ${INSTALL_COMPRESSED} ${.CURDIR:T}.pdb.${_curcomp}: ${DOC}.pdb.${_curcomp} ${LN} -f ${.ALLSRC} ${.TARGET} .endfor .endif ${DOC}.tar: ${SRCS} ${LOCAL_IMAGES} ${LOCAL_CSS_SHEET} ${TAR} cf ${.TARGET} -C ${.CURDIR} ${SRCS} \ -C ${.OBJDIR} ${IMAGES} ${CSS_SHEET:T} # # Build targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .if !target(${DOC}.${_curformat}) ${DOC}.${_curformat}: @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document. .endif .endfor # ------------------------------------------------------------------------ # # Validation targets # # # Lets you quickly check that the document conforms to the DTD without # having to convert it to any other formats # lint validate: ${NSGMLS} -s -c ${HTMLCATALOG} ${MASTERDOC} # ------------------------------------------------------------------------ # # Compress targets # # # The list of compression extensions this Makefile knows about. If you # add new compression schemes, add to this list (which is a list of # extensions, hence bz2, *not* bzip2) and extend the _PROG_COMPRESS_* # targets. # KNOWN_COMPRESS= gz bz2 zip # # You can't build suffix rules to do compression, since you can't # wildcard the source suffix. So these are defined .USE, to be tacked on # as dependencies of the compress-* targets. # _PROG_COMPRESS_gz: .USE ${GZIP_CMD} < ${.ALLSRC} > ${.TARGET} _PROG_COMPRESS_bz2: .USE ${BZIP2_CMD} < ${.ALLSRC} > ${.TARGET} _PROG_COMPRESS_zip: .USE ${ZIP_CMD} ${.TARGET} ${.ALLSRC} # # Build a list of targets for each compression scheme and output format. # Don't compress the html-split output format. # .for _curformat in ${KNOWN_FORMATS} _cf=${_curformat} .for _curcompress in ${KNOWN_COMPRESS} ${DOC}.${_cf}.${_curcompress}: ${DOC}.${_cf} _PROG_COMPRESS_${_curcompress} .endfor .endfor # # Build targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .for _curcompress in ${KNOWN_COMPRESS} .if !target(${DOC}.${_curformat}.${_curcompress}) ${DOC}.${_curformat}.${_curcompress}: @${ECHO_CMD} \"${_curformat}.${_curcompress}\" is not a valid output format for this document. .endif .endfor .endfor # ------------------------------------------------------------------------ # # Install targets # # Build install-* targets, one per allowed value in FORMATS. # # "beforeinstall" and "afterinstall" are hooks in to this process. # Redefine them to do things before and after the files are installed, # respectively. # # Build a list of install-format targets to be installed. These will be # dependencies for the "realinstall" target. # .if !defined(INSTALL_ONLY_COMPRESSED) || empty(INSTALL_ONLY_COMPRESSED) _curinst+= ${FORMATS:S/^/install-/g} .endif realinstall: ${_curinst} .for _curformat in ${KNOWN_FORMATS} _cf=${_curformat} .if !target(install-${_cf}) install-${_curformat}: ${DOC}.${_curformat} @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR} ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR} .if !empty(CSS_SHEET) ${INSTALL_DOCS} ${CSS_SHEET} ${DESTDIR} .endif .for _curimage in ${IMAGES_LIB} @[ -d ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ] || \ ${MKDIR} -p ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ${INSTALL_DOCS} ${LOCAL_IMAGES_LIB_DIR}/${_curimage} \ ${DESTDIR}/${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} .endfor # Install the images. First, loop over all the image names that contain a # directory seperator, make the subdirectories, and install. Then loop over # the ones that don't contain a directory separator, and install them in the # top level. .for _curimage in ${IMAGES_PNG:M*/*} ${MKDIR} -p ${DESTDIR}/${_curimage:H} ${INSTALL_DOCS} ${.CURDIR}/${_curimage} ${DESTDIR}/${_curimage:H} .endfor .for _curimage in ${IMAGES_PNG:N*/*} ${INSTALL_DOCS} ${.CURDIR}/${_curimage} ${DESTDIR} .endfor .if ${_cf} == "pdb" ${LN} -f ${DESTDIR}/${.ALLSRC} ${DESTDIR}/${.CURDIR:T}.${_curformat} .endif .for _compressext in ${KNOWN_COMPRESS} install-${_cf}.${_compressext}: ${DOC}.${_cf}.${_compressext} @[ -d ${DESTDIR} ] || ${MKDIR} -p ${DESTDIR} ${INSTALL_DOCS} ${.ALLSRC} ${DESTDIR} .endfor .endif .endfor # # Build install- targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .if !target(install-${_curformat}) install-${_curformat}: @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document. .for _compressext in ${KNOWN_COMPRESS} install-${_curformat}.${_compressext}: @${ECHO_CMD} \"${_curformat}.${_compressext}\" is not a valid output format for this document. .endfor .endif .endfor # ------------------------------------------------------------------------ # # Package building # # # realpackage is what is called in each subdirectory when a package # target is called, or, rather, package calls realpackage in each # subdirectory as it goes. # # packagelist returns the list of targets that would be called during # package building. # realpackage: ${FORMATS:S/^/package-/} packagelist: @${ECHO_CMD} ${FORMATS:S/^/package-/} # # Build a list of package targets for each output target. Each package # target depends on the corresponding install target running. # .for _curformat in ${KNOWN_FORMATS} _cf=${_curformat} PLIST.${_curformat}: ${DOC}.${_curformat} @${ECHO_CMD} ${DOC}.${_curformat} > PLIST.${_curformat} .if ${_cf} == "html" && \ (!empty(LOCAL_IMAGES_LIB) || !empty(IMAGES_PNG) || !empty(CSS_SHEET)) @${ECHO_CMD} ${LOCAL_IMAGES_LIB} ${IMAGES_PNG} ${CSS_SHEET} | \ ${XARGS} -n1 >> PLIST.${_curformat} .elif ${_cf} == "pdb" @${ECHO_CMD} ${.CURDIR:T}.${_curformat} >> PLIST.${_curformat} .endif ${PACKAGES}/${.CURDIR:T}.${LANGCODE}.${_curformat}.tgz: PLIST.${_curformat} @${PKG_CREATE} -v -f PLIST.${_curformat} -p ${DESTDIR} -s ${.OBJDIR} \ -c -"FDP ${.CURDIR:T} ${_curformat} package" \ -d -"FDP ${.CURDIR:T} ${_curformat} package" ${.TARGET} package-${_curformat}: ${PACKAGES}/${.CURDIR:T}.${LANGCODE}.${_curformat}.tgz .endfor # # Build install- targets for any formats we've missed that we don't handle. # .for _curformat in ${ALL_FORMATS} .if !target(package-${_curformat}) package-${_curformat}: @${ECHO_CMD} \"${_curformat}\" is not a valid output format for this document. .endif .endfor .if ${LOCAL_CSS_SHEET} != ${CSS_SHEET} ${LOCAL_CSS_SHEET}: ${CSS_SHEET} ${CP} -p ${.ALLSRC} ${.TARGET} .endif diff --git a/share/mk/doc.images.mk b/share/mk/doc.images.mk index bad8674776..d77187ae8c 100644 --- a/share/mk/doc.images.mk +++ b/share/mk/doc.images.mk @@ -1,193 +1,199 @@ # # $FreeBSD$ # # This include file handles image processing. # # There are two types of images that must be handled: # # 1. Images from the library directory, that are shared across multiple # documents. # # 2. Images that are document specific. # # For library images this file ensures that they are copied in to the # documents directory so that they can be reference properly. # # For library images *and* document specific images, this file ensures # that the images are converted from their repository format to the # correct output format. # # # Using document specific images # ------------------------------ # # The images that each document provides *from the repository* are listed in # the IMAGES variable. # # We then need to build a list of images that must be generated from these. # This is to handle the case where a document might include some images as # bitmaps and some as vector images in the repository, but where, depending # on the output format, you want all the images in one format or another. # # This list of generated images can then be cleaned in the clean target # later # # This is the same for each format. To use IMAGES_GEN_PNG as an example, # the substitution means "First match, using M, all the components of # ${IMAGES} that match the '*.eps' regexp. Then, search/replace the .eps # in the matching filenames with .png. Finally, stick the results in the # ${IMAGES_GEN_PNG} variable." ${IMAGES_GEN_PNG} then contains the names # of all the .eps images listed, but with a .png extension. This is the # list of files we need to generate if we need PNG format images. # # The PDF generation, when it's looking for file 'foo', will first try # foo.pdf, and it will try foo.png. There's no point converting PNG files # to PDF, as they'll be used directly. However, we can convert the EPS files # to PDF, and hopefully get better quality. # _IMAGES_PNG= ${IMAGES:M*.png} _IMAGES_EPS= ${IMAGES:M*.eps} _IMAGES_SCR= ${IMAGES:M*.scr} IMAGES_GEN_PNG= ${_IMAGES_EPS:S/.eps$/.png/} IMAGES_GEN_EPS= ${_IMAGES_PNG:S/.png$/.eps/} IMAGES_GEN_PDF= ${_IMAGES_EPS:S/.eps$/.pdf/} IMAGES_SCR_PNG= ${_IMAGES_SCR:S/.scr$/.png/} IMAGES_SCR_EPS= ${_IMAGES_SCR:S/.scr$/.eps/} CLEANFILES+= ${IMAGES_GEN_PNG} ${IMAGES_GEN_EPS} ${IMAGES_GEN_PDF} CLEANFILES+= ${IMAGES_SCR_PNG} ${IMAGES_SCR_EPS} IMAGES_PNG= ${_IMAGES_PNG} ${IMAGES_GEN_PNG} ${IMAGES_SCR_PNG} IMAGES_EPS= ${_IMAGES_EPS} ${IMAGES_GEN_EPS} ${IMAGES_SCR_EPS} .if ${.OBJDIR} != ${.CURDIR} LOCAL_IMAGES= ${IMAGES:S|^|${.OBJDIR}/|} CLEANFILES+= ${LOCAL_IMAGES} .if !empty(_IMAGES_PNG) LOCAL_IMAGES_PNG= ${_IMAGES_PNG:S|^|${.OBJDIR}/|} .endif .if !empty(_IMAGES_EPS) LOCAL_IMAGES_EPS= ${_IMAGES_EPS:S|^|${.OBJDIR}/|} .endif .else LOCAL_IMAGES= ${IMAGES} LOCAL_IMAGES_PNG= ${_IMAGES_PNG} LOCAL_IMAGES_EPS= ${_IMAGES_EPS} .endif LOCAL_IMAGES_PNG+= ${IMAGES_GEN_PNG} ${IMAGES_SCR_PNG} LOCAL_IMAGES_EPS+= ${IMAGES_GEN_EPS} ${IMAGES_SCR_EPS} # The default resolution eps2png (82) assumes a 640x480 monitor, and is too # low for the typical monitor in use today. The resolution of 100 looks # much better on these monitors without making the image too large for # a 640x480 monitor. EPS2PNG_RES?= 100 # We only need to list ${IMAGES_GEN_PDF} here. If all the source files are # EPS then they'll be in this variable; if any of the source files are PNG # then we can use them directly, and don't need to list them. IMAGES_PDF=${IMAGES_GEN_PDF} SCR2PNG?= ${PREFIX}/bin/scr2png +SCR2PNGOPTS?= ${SCR2PNGFLAGS} EPS2PNG?= ${PREFIX}/bin/peps -EPS2PNGFLAGS?= -p -r ${EPS2PNG_RES} +EPS2PNGOPTS?= -p -r ${EPS2PNG_RES} ${EPS2PNGFLAGS} PNGTOPNM?= ${PREFIX}/bin/pngtopnm +PNGTOPNMOPTS?= ${PNGTOPNMFLAGS} PNMTOPS?= ${PREFIX}/bin/pnmtops -PNMTOPSFLAGS?= -noturn +PNMTOPSOPTS?= -noturn ${PNMTOPSFLAGS} EPSTOPDF?= ${PREFIX}/bin/epstopdf +EPSTOPDFOPTS?= ${EPSTOPDFFLAGS} # Use suffix rules to convert .scr files to .png files .SUFFIXES: .scr .png .eps .scr.png: - ${SCR2PNG} < ${.IMPSRC} > ${.TARGET} + ${SCR2PNG} ${SCR2PNGOPTS} < ${.IMPSRC} > ${.TARGET} .scr.eps: - ${SCR2PNG} < ${.ALLSRC} | ${PNGTOPNM} | \ - ${PNMTOPS} ${PNMTOPSFLAGS} > ${.TARGET} + ${SCR2PNG} ${SCR2PNGOPTS} < ${.ALLSRC} | \ + ${PNGTOPNM} ${PNGTOPNMOPTS} | \ + ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} # We can't use suffix rules to generate the rules to convert EPS to PNG and # PNG to EPS. This is because a .png file can depend on a .eps file, and # vice versa, leading to a loop in the dependency graph. Instead, build # the targets on the fly. .for _curimage in ${IMAGES_GEN_PNG} ${_curimage}: ${_curimage:S/.png$/.eps/} - ${EPS2PNG} ${EPS2PNGFLAGS} -o ${.TARGET} ${.ALLSRC} + ${EPS2PNG} ${EPS2PNGOPTS} -o ${.TARGET} ${.ALLSRC} .endfor .for _curimage in ${IMAGES_GEN_EPS} ${_curimage}: ${_curimage:S/.eps$/.png/} - ${PNGTOPNM} ${.ALLSRC} | ${PNMTOPS} ${PNMTOPSFLAGS} > ${.TARGET} + ${PNGTOPNM} ${PNGTOPNMOPTS} ${.ALLSRC} | \ + ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} .endfor .for _curimage in ${IMAGES_GEN_PDF} ${_curimage}: ${_curimage:S/.pdf$/.eps/} - ${EPSTOPDF} --outfile=${.TARGET} ${.CURDIR}/${_curimage:S/.pdf$/.eps/} + ${EPSTOPDF} ${EPSTOPDFOPTS} --outfile=${.TARGET} \ + ${.CURDIR}/${_curimage:S/.pdf$/.eps/} .endfor .if ${.OBJDIR} != ${.CURDIR} .for _curimage in ${IMAGES} ${.OBJDIR}/${_curimage}: ${_curimage} ${CP} -p ${.ALLSRC} ${.TARGET} .endfor .endif # # Using library images # -------------------- # # Each document that wants to use one or more library images has to # list them in the IMAGES_LIB variable. For example, a document that wants # to use callouts 1 thru 4 has to list # # IMAGES_LIB= callouts/1.png callouts/2.png callouts/3.png callouts/4.png # # in the controlling Makefile. # # This code ensures they exist in the current directory, and copies them in # as necessary. # IMAGES_LIB?= LOCAL_IMAGES_LIB ?= # # The name of the directory that contains all the library images for this # language and encoding # IMAGES_LIB_DIR?= ${.CURDIR}/../../share/images # # The name of the directory *in* the document directory where files and # directory hierarchies should be copied to. "images" is too generic, and # might clash with local document images, so use "imagelib" by default # instead. If you redefine this then you must also update the # %callout-graphics-path% variable in the .dsl file. # LOCAL_IMAGES_LIB_DIR?= imagelib # # Create a target for each image used from the library. This target just # ensures that each image required is copied from its location in # ${IMAGES_LIB_DIR} to the same place in ${LOCAL_IMAGES_LIB_DIR}. # .for _curimage in ${IMAGES_LIB} LOCAL_IMAGES_LIB += ${LOCAL_IMAGES_LIB_DIR}/${_curimage} ${LOCAL_IMAGES_LIB_DIR}/${_curimage}: ${IMAGES_LIB_DIR}/${_curimage} @[ -d ${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ] || \ ${MKDIR} ${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ${CP} -p ${IMAGES_LIB_DIR}/${_curimage} \ ${LOCAL_IMAGES_LIB_DIR}/${_curimage} .endfor .if !empty(IMAGES_LIB) CLEANFILES+= ${IMAGES_LIB:S|^|${LOCAL_IMAGES_LIB_DIR}/|} .endif diff --git a/share/mk/doc.subdir.mk b/share/mk/doc.subdir.mk index 0f291fe3af..c2eb899499 100644 --- a/share/mk/doc.subdir.mk +++ b/share/mk/doc.subdir.mk @@ -1,208 +1,211 @@ # Taken from: # Id: bsd.subdir.mk,v 1.27 1999/03/21 06:43:40 bde # # $FreeBSD$ # # This include file contains the default targets # for building subdirectories in the FreeBSD Documentation Project. # # For all of the directories listed in the variable SUBDIR, the # specified directory will be visited and the target made. There is # also a default target which allows the command "make subdir" where # subdir is any directory listed in the variable SUBDIR. # # ------------------------------------------------------------------------ # # Document-specific variables: # # SUBDIR A list of subdirectories that should be # built as well. Each of the targets will # execute the same target in the # subdirectories. # # COMPAT_SYMLINK Create a symlink named in this variable # to this directory, when installed. # # ROOT_SYMLINKS Create symlinks to the named directories # in the document root, if the current # language is the primary language (the # PRI_LANG variable). # # ------------------------------------------------------------------------ # # Provided targets: # # install: # package: # Go down subdirectories and call these targets # along the way, and then call the real target # here. # # clean: # Remove files created by the build process. # # cleandir: # Remove the object directory, if any. # +.if !target(__initialized__) +__initialized__: .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" .endif +.endif .if !target(install) install: afterinstall symlinks afterinstall: realinstall realinstall: beforeinstall _SUBDIRUSE .endif package: realpackage symlinks realpackage: _SUBDIRUSE .if !defined(IGNORE_COMPAT_SYMLINK) && defined(COMPAT_SYMLINK) SYMLINKS+= ${DOCDIR} ${.CURDIR:T:ja_JP.eucJP=ja} \ ${COMPAT_SYMLINK:ja=ja_JP.eucJP} .endif .if defined(PRI_LANG) && defined(ROOT_SYMLINKS) && !empty(ROOT_SYMLINKS) .if ${PRI_LANG} == ${LANGCODE} .for _tmp in ${ROOT_SYMLINKS} SYMLINKS+= ${DOCDIR} ${LANGCODE:ja_JP.eucJP=ja}/${.CURDIR:T}/${_tmp} ${_tmp} .endfor .endif .endif .if !target(symlinks) symlinks: .if defined(SYMLINKS) && !empty(SYMLINKS) @set $$(${ECHO_CMD} ${SYMLINKS}); \ while : ; do \ case $$# in \ 0) break;; \ [12]) ${ECHO_CMD} "warn: empty SYMLINKS: $$1 $$2"; break;; \ esac; \ d=$$1; shift; \ l=$$1; shift; \ t=$$1; shift; \ if [ ! -e $${d}/$${l} ]; then \ ${ECHO} "$${d}/$${l} doesn't exist, not linking"; \ else \ ${ECHO} $${d}/$${t} -\> $${d}/$${l}; \ (cd $${d} && ${RM} -rf $${t}); \ (cd $${d} && ${LN} -s $${l} $${t}); \ fi; \ done .endif .endif .for __target in beforeinstall afterinstall realinstall realpackage .if !target(${__target}) ${__target}: .endif .endfor _SUBDIRUSE: .USE .for entry in ${SUBDIR} @${ECHODIR} "===> ${DIRPRFX}${entry}" @cd ${.CURDIR}/${entry} && \ ${MAKE} ${.TARGET:S/realpackage/package/:S/realinstall/install/} \ DIRPRFX=${DIRPRFX}${entry}/ .endfor .if !defined(NOINCLUDEMK) .include .include .else .MAIN: all ${SUBDIR}:: @cd ${.CURDIR}/${.TARGET} && ${MAKE} all .for __target in all cleandir lint objlink install .if !target(${__target}) ${__target}: _SUBDIRUSE .endif .endfor .if !target(obj) obj: _SUBDIRUSE @if ! [ -d ${CANONICALOBJDIR}/ ]; then \ ${MKDIR} -p ${CANONICALOBJDIR}; \ if ! [ -d ${CANONICALOBJDIR}/ ]; then \ ${ECHO_CMD} "Unable to create ${CANONICALOBJDIR}."; \ exit 1; \ fi; \ ${ECHO} "${CANONICALOBJDIR} created ${.CURDIR}"; \ fi .endif .if !target(objlink) objlink: _SUBDIRUSE @if [ -d ${CANONICALOBJDIR}/ ]; then \ ${RM} -f ${.CURDIR}/obj; \ ${LN} -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \ else \ ${ECHO_CMD} "No ${CANONICALOBJDIR} to link to - do a make obj."; \ fi .endif .if !target(whereobj) whereobj: @${ECHO_CMD} ${.OBJDIR} .endif cleanobj: @if [ -d ${CANONICALOBJDIR}/ ]; then \ ${RM} -rf ${CANONICALOBJDIR}; \ else \ cd ${.CURDIR} && ${MAKE} clean cleandepend; \ fi @if [ -h ${.CURDIR}/obj ]; then ${RM} -f ${.CURDIR}/obj; fi .if !target(clean) clean: _SUBDIRUSE .if defined(CLEANFILES) && !empty(CLEANFILES) ${RM} -f ${CLEANFILES} .endif .if defined(CLEANDIRS) && !empty(CLEANDIRS) ${RM} -rf ${CLEANDIRS} .endif .if defined(IMAGES_LIB) && !empty(LOCAL_IMAGES_LIB_DIR) ${RM} -rf ${LOCAL_IMAGES_LIB_DIR} .endif .endif cleandir: cleanobj _SUBDIRUSE .endif # end of NOINCLUDEMK section # # Create /usr/obj image subdirs when ${IMAGES} contains subdir/image.xxx # _imagesubdir= .for _imagedir in ${IMAGES:H} .if ${_imagesubdir:M${_imagedir}} == "" _imagesubdir+= ${_imagedir} .endif .endfor .if ${_imagesubdir} != "" _IMAGESUBDIR: .USE .for dir in ${_imagesubdir} @if ! [ -d ${CANONICALOBJDIR}/${dir}/ ]; then \ ${MKDIR} -p ${CANONICALOBJDIR}/${dir}; \ if ! [ -d ${CANONICALOBJDIR}/${dir}/ ]; then \ ${ECHO_CMD} "Unable to create ${CANONICALOBJDIR}/${dir}/."; \ exit 1; \ fi; \ ${ECHO} "${CANONICALOBJDIR}/${dir}/ created for ${.CURDIR}"; \ fi .endfor obj: _IMAGESUBDIR .endif