bsd.doc.mk revision 139106
1290650Shselasky# from: @(#)bsd.doc.mk 5.3 (Berkeley) 1/2/91 2347819Shselasky# $FreeBSD: head/share/mk/bsd.doc.mk 139106 2004-12-21 09:33:47Z ru $ 3290650Shselasky# 4290650Shselasky# The include file <bsd.doc.mk> handles installing BSD troff documents. 5290650Shselasky# 6290650Shselasky# 7290650Shselasky# +++ variables +++ 8290650Shselasky# 9290650Shselasky# DCOMPRESS_CMD Program to compress troff documents. Output is to stdout. 10290650Shselasky# [${COMPRESS_CMD}] 11290650Shselasky# 12290650Shselasky# DESTDIR Change the tree where the documents get installed. [not set] 13290650Shselasky# 14290650Shselasky# DOC Document name. [paper] 15290650Shselasky# 16290650Shselasky# EXTRA Extra files (not SRCS) that make up the document. [not set] 17290650Shselasky# 18290650Shselasky# LPR Printer command. [lpr] 19290650Shselasky# 20290650Shselasky# MACROS Macro packages used to build the document. [not set] 21290650Shselasky# 22290650Shselasky# NO_DOCCOMPRESS If you do not want formatted troff documents to be 23290650Shselasky# compressed when they are installed. [not set] 24290650Shselasky# 25290650Shselasky# PRINTERDEVICE Indicates which output formats will be generated 26290650Shselasky# (ascii, ps, html). [ascii] 27290650Shselasky# 28290650Shselasky# SRCDIR Directory where source files live. [${.CURDIR}] 29290650Shselasky# 30290650Shselasky# SRCS List of source files. [not set] 31290650Shselasky# 32290650Shselasky# TRFLAGS Additional flags to groff(1). [not set] 33290650Shselasky# 34290650Shselasky# USE_EQN If set, preprocess with eqn(1). [not set] 35290650Shselasky# 36347802Shselasky# USE_PIC If set, preprocess with pic(1). [not set] 37290650Shselasky# 38290650Shselasky# USE_REFER If set, preprocess with refer(1). [not set] 39290650Shselasky# 40290650Shselasky# USE_SOELIM If set, preprocess with soelim(1). [not set] 41353197Shselasky# 42359544Skib# USE_TBL If set, preprocess with tbl(1). [not set] 43290650Shselasky# 44290650Shselasky# VOLUME Volume the document belongs to. [not set] 45341958Shselasky 46341958Shselasky.include <bsd.init.mk> 47290650Shselasky 48359544SkibPRINTERDEVICE?= ascii 49329200Shselasky 50359540SkibBIB?= bib 51359540SkibGREMLIN?= grn 52359540SkibGRIND?= vgrind -f 53359540SkibINDXBIB?= indxbib 54359540SkibPIC?= pic 55290650ShselaskyREFER?= refer 56341948Shselasky.for _dev in ${PRINTERDEVICE:Mascii} 57341948ShselaskyROFF.ascii?= groff -Tascii ${TRFLAGS} -mtty-char ${MACROS} -o${PAGES} 58290650Shselasky.endfor 59290650Shselasky.for _dev in ${PRINTERDEVICE:Nascii} 60290650ShselaskyROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} -o${PAGES} 61290650Shselasky.endfor 62347839ShselaskySOELIM?= soelim 63347847ShselaskyTBL?= tbl 64290650Shselasky 65290650ShselaskyDOC?= paper 66347835ShselaskyLPR?= lpr 67347835Shselasky 68290650Shselasky.if defined(USE_EQN) 69347835ShselaskyTRFLAGS+= -e 70347835Shselasky.endif 71347835Shselasky.if defined(USE_PIC) 72290650ShselaskyTRFLAGS+= -p 73290650Shselasky.endif 74347835Shselasky.if defined(USE_REFER) 75347835ShselaskyTRFLAGS+= -R 76347835Shselasky.endif 77347835Shselasky.if defined(USE_SOELIM) 78290650ShselaskyTRFLAGS+= -I${SRCDIR} 79347819Shselasky.endif 80347819Shselasky.if defined(USE_TBL) 81347819ShselaskyTRFLAGS+= -t 82347819Shselasky.endif 83347819Shselasky 84290650ShselaskyDCOMPRESS_EXT?= ${COMPRESS_EXT} 85290650ShselaskyDCOMPRESS_CMD?= ${COMPRESS_CMD} 86290650Shselasky.for _dev in ${PRINTERDEVICE:Mhtml} 87290650ShselaskyDFILE.html= ${DOC}.html 88290650Shselasky.endfor 89290650Shselasky.for _dev in ${PRINTERDEVICE:Nhtml} 90290650Shselasky.if defined(NO_DOCCOMPRESS) 91290650ShselaskyDFILE.${_dev}= ${DOC}.${_dev} 92290650Shselasky.else 93290650ShselaskyDFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS_EXT} 94290650Shselasky.endif 95290650Shselasky.endfor 96329209Shselasky 97329209ShselaskyPAGES?= 1- 98329209Shselasky 99329209ShselaskyUNROFF?= unroff 100329209ShselaskyHTML_SPLIT?= yes 101290650ShselaskyUNROFFFLAGS?= -fhtml 102290650Shselasky.if ${HTML_SPLIT} == "yes" 103290650ShselaskyUNROFFFLAGS+= split=1 104290650Shselasky.endif 105290650Shselasky 106290650Shselasky# Compatibility mode flag for groff. Use this when formatting documents with 107290650Shselasky# Berkeley me macros (orig_me(7)). 108290650ShselaskyCOMPAT?= -C 109290650Shselasky 110290650Shselasky.PATH: ${.CURDIR} ${SRCDIR} 111290650Shselasky 112290650Shselasky.for _dev in ${PRINTERDEVICE} 113290650Shselaskyall: ${DFILE.${_dev}} 114290650Shselasky.endfor 115290650Shselasky 116290650Shselasky.if !target(print) 117290650Shselasky.for _dev in ${PRINTERDEVICE} 118290650Shselaskyprint: ${DFILE.${_dev}} 119290650Shselasky.endfor 120290650Shselaskyprint: 121290650Shselasky.for _dev in ${PRINTERDEVICE} 122290650Shselasky.if defined(NO_DOCCOMPRESS) 123290650Shselasky ${LPR} ${DFILE.${_dev}} 124290650Shselasky.else 125290650Shselasky ${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR} 126290650Shselasky.endif 127290650Shselasky.endfor 128290650Shselasky.endif 129290650Shselasky 130290650Shselasky.for _dev in ${PRINTERDEVICE:Nascii:Nps:Nhtml} 131290650ShselaskyCLEANFILES+= ${DOC}.${_dev} ${DOC}.${_dev}${DCOMPRESS_EXT} 132290650Shselasky.endfor 133290650ShselaskyCLEANFILES+= ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \ 134290650Shselasky ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \ 135290650Shselasky ${DOC}.html ${DOC}-*.html 136290650Shselasky 137290650Shselaskyrealinstall: 138290650Shselasky.for _dev in ${PRINTERDEVICE:Mhtml} 139290650Shselasky cd ${SRCDIR}; \ 140290650Shselasky ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 141290650Shselasky ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME} 142290650Shselasky.endfor 143290650Shselasky.for _dev in ${PRINTERDEVICE:Nhtml} 144290650Shselasky ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 145290650Shselasky ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME} 146290650Shselasky.endfor 147290650Shselasky 148290650Shselaskyspell: ${SRCS} 149290650Shselasky (cd ${.CURDIR}; spell ${SRCS} ) | sort | \ 150290650Shselasky comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell 151290650Shselasky 152290650ShselaskyBINDIR?= /usr/share/doc 153290650ShselaskyBINMODE= 444 154290650Shselasky 155290650ShselaskySRCDIR?= ${.CURDIR} 156290650Shselasky 157290650Shselasky.if defined(EXTRA) && !empty(EXTRA) 158290650Shselasky_stamp.extra: ${EXTRA} 159290650Shselasky touch ${.TARGET} 160290650Shselasky.endif 161290650Shselasky 162290650ShselaskyCLEANFILES+= _stamp.extra 163290650Shselasky.for _dev in ${PRINTERDEVICE:Nhtml} 164290650Shselasky.if !target(${DFILE.${_dev}}) 165290650Shselasky.if target(_stamp.extra) 166290650Shselasky${DFILE.${_dev}}: _stamp.extra 167290650Shselasky.endif 168290650Shselasky${DFILE.${_dev}}: ${SRCS} 169290650Shselasky.if defined(NO_DOCCOMPRESS) 170290650Shselasky ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET} 171290650Shselasky.else 172290650Shselasky ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET} 173290650Shselasky.endif 174290650Shselasky.endif 175290650Shselasky.endfor 176290650Shselasky 177290650Shselasky.for _dev in ${PRINTERDEVICE:Mhtml} 178290650Shselasky.if !target(${DFILE.html}) 179290650Shselasky.if target(_stamp.extra) 180359544Skib${DFILE.html}: _stamp.extra 181359544Skib.endif 182365414Skib${DFILE.html}: ${SRCS} 183365414Skib.if defined(MACROS) && !empty(MACROS) 184359544Skib cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \ 185359544Skib document=${DOC} ${SRCS} 186290650Shselasky.else # unroff(1) requires a macro package as an argument 187290650Shselasky cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \ 188353224Shselasky document=${DOC} ${SRCS} 189290650Shselasky.else 190290650Shselasky.endif 191290650Shselasky.endif 192290650Shselasky.endfor 193353224Shselasky 194290650ShselaskyDISTRIBUTION?= doc 195290650Shselasky 196353224Shselasky.include <bsd.obj.mk> 197290650Shselasky