1 # from: @(#)bsd.doc.mk 5.3 (Berkeley) 1/2/91
4 # The include file <bsd.doc.mk> handles installing BSD troff documents.
9 # DCOMPRESS_CMD Program to compress troff documents. Output is to stdout.
12 # DESTDIR Change the tree where the documents get installed. [not set]
14 # DOC Document name. [paper]
16 # EXTRA Extra files (not SRCS) that make up the document. [not set]
18 # LPR Printer command. [lpr]
20 # MACROS Macro packages used to build the document. [not set]
22 # WITHOUT_DOCCOMPRESS If you do not want formatted troff documents to be
23 # compressed when they are installed. [not set]
25 # PRINTERDEVICE Indicates which output formats will be generated
26 # (ascii, ps, html). [ascii]
28 # SRCDIR Directory where source files live. [${.CURDIR}]
30 # SRCS List of source files. [not set]
32 # TRFLAGS Additional flags to groff(1). [not set]
34 # USE_EQN If set, preprocess with eqn(1). [not set]
36 # USE_PIC If set, preprocess with pic(1). [not set]
38 # USE_REFER If set, preprocess with refer(1). [not set]
40 # USE_SOELIM If set, preprocess with soelim(1). [not set]
42 # USE_TBL If set, preprocess with tbl(1). [not set]
44 # VOLUME Volume the document belongs to. [not set]
46 .include <bsd.init.mk>
56 .for _dev in ${PRINTERDEVICE:Mascii}
57 ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1}
59 .for _dev in ${PRINTERDEVICE:Nascii}
60 ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1}
74 .if defined(USE_REFER)
77 .if defined(USE_SOELIM)
78 TRFLAGS+= -I${.CURDIR}
85 .if !defined(TAGS) || ! ${TAGS:Mpackage=*}
86 TAGS+= package=${PACKAGE:Uruntime}
88 TAG_ARGS= -T ${TAGS:[*]:S/ /,/g}
91 DCOMPRESS_EXT?= ${COMPRESS_EXT}
92 DCOMPRESS_CMD?= ${COMPRESS_CMD}
93 .for _dev in ${PRINTERDEVICE:Mhtml}
94 DFILE.html= ${DOC}.html
96 .for _dev in ${PRINTERDEVICE:Nhtml}
97 .if ${MK_DOCCOMPRESS} == "no"
98 DFILE.${_dev}= ${DOC}.${_dev}
100 DFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS_EXT}
107 .if ${HTML_SPLIT} == "yes"
108 UNROFFFLAGS+= split=1
111 # Compatibility mode flag for groff. Use this when formatting documents with
112 # Berkeley me macros (orig_me(7)).
115 .PATH: ${.CURDIR} ${SRCDIR}
117 .if !defined(_SKIP_BUILD)
118 .for _dev in ${PRINTERDEVICE}
119 all: ${DFILE.${_dev}}
124 .for _dev in ${PRINTERDEVICE}
125 print: ${DFILE.${_dev}}
128 .for _dev in ${PRINTERDEVICE}
129 .if ${MK_DOCCOMPRESS} == "no"
130 ${LPR} ${DFILE.${_dev}}
132 ${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR}
137 .for _dev in ${PRINTERDEVICE:Nascii:Nps:Nhtml}
138 CLEANFILES+= ${DOC}.${_dev} ${DOC}.${_dev}${DCOMPRESS_EXT}
140 CLEANFILES+= ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
141 ${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
142 ${DOC}.html ${DOC}-*.html
145 .if ${PRINTERDEVICE:Mhtml}
147 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},docs} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
148 ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}/
150 .for _dev in ${PRINTERDEVICE:Nhtml}
151 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},docs} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
152 ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}/
156 (cd ${.CURDIR}; spell ${SRCS} ) | sort | \
157 comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
159 BINDIR?= /usr/share/doc
164 .if defined(EXTRA) && !empty(EXTRA)
165 _stamp.extra: ${EXTRA}
169 CLEANFILES+= _stamp.extra
170 .for _dev in ${PRINTERDEVICE:Nhtml}
171 .if !target(${DFILE.${_dev}})
172 .if target(_stamp.extra)
173 ${DFILE.${_dev}}: _stamp.extra
175 ${DFILE.${_dev}}: ${SRCS}
176 .if ${MK_DOCCOMPRESS} == "no"
177 ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET}
179 ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET}
184 .for _dev in ${PRINTERDEVICE:Mhtml}
185 .if !target(${DFILE.html})
186 .if target(_stamp.extra)
187 ${DFILE.html}: _stamp.extra
189 ${DFILE.html}: ${SRCS}
190 .if defined(MACROS) && !empty(MACROS)
191 cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
192 document=${DOC} ${SRCS}
193 .else # unroff(1) requires a macro package as an argument
194 cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \
195 document=${DOC} ${SRCS}
202 .include <bsd.obj.mk>