bsd.doc.mk revision 106211
160107Sobrien#	from: @(#)bsd.doc.mk	5.3 (Berkeley) 1/2/91
232822Syokota# $FreeBSD: head/share/mk/bsd.doc.mk 106211 2002-10-30 17:03:48Z ru $
332822Syokota#
432822Syokota# The include file <bsd.doc.mk> handles installing BSD troff documents.
532822Syokota#
632822Syokota#
732822Syokota# +++ variables +++
832822Syokota#
932822Syokota# DCOMPRESS_CMD	Program to compress troff documents.  Output is to stdout.
1042782Syokota#		[${COMPRESS_CMD}]
1142782Syokota#
1232822Syokota# DESTDIR	Change the tree where the documents get installed.  [not set]
1332822Syokota#
1432822Syokota# DOC		Document name.  [paper]
1532822Syokota#
1632822Syokota# EXTRA		Extra files (not SRCS) that make up the document.  [not set]
1732822Syokota#
1842782Syokota# LPR		Printer command.  [lpr]
1932822Syokota#
2032822Syokota# MACROS	Macro packages used to build the document.  [not set]
2132822Syokota#
2232822Syokota# NODOCCOMPRESS	If you do not want formatted troff documents to be
2332822Syokota#		compressed when they are installed.  [not set]
2432822Syokota#
2532822Syokota# PRINTERDEVICE	Indicates which output formats will be generated
2632822Syokota#		(ascii, ps, html).  [ascii]
2732822Syokota#
2832822Syokota# SRCDIR	Directory where source files live.  [${.CURDIR}]
2932822Syokota#
3032822Syokota# SRCS		List of source files.  [not set]
3132822Syokota#
3242782Syokota# TRFLAGS	Additional flags to groff(1).  [not set]
3342782Syokota#
3432822Syokota# USE_EQN	If set, preprocess with eqn(1).  [not set]
3532822Syokota#
3632822Syokota# USE_PIC	If set, preprocess with pic(1).  [not set]
3732822Syokota#
3832822Syokota# USE_REFER	If set, preprocess with refer(1).  [not set]
3932822Syokota#
4032822Syokota# USE_SOELIM	If set, preprocess with soelim(1).  [not set]
4132822Syokota#
4232822Syokota# USE_TBL	If set, preprocess with tbl(1).  [not set]
4332822Syokota#
4432822Syokota# VOLUME	Volume the document belongs to.  [not set]
4532822Syokota
4642782Syokota.include <bsd.init.mk>
4742782Syokota
4832822SyokotaPRINTERDEVICE?=	ascii
4942782Syokota
5032822SyokotaBIB?=		bib
5132822SyokotaGREMLIN?=	grn
5232822SyokotaGRIND?=		vgrind -f
5332822SyokotaINDXBIB?=	indxbib
5432822SyokotaPIC?=		pic
5532822SyokotaREFER?=		refer
5632822Syokota.for _dev in ${PRINTERDEVICE:Mascii}
5742782SyokotaROFF.ascii?=	groff -Tascii ${TRFLAGS} -mtty-char ${MACROS} -o${PAGES}
5842782Syokota.endfor
5942782Syokota.for _dev in ${PRINTERDEVICE:Nascii}
6032822SyokotaROFF.${_dev}?=	groff -T${_dev} ${TRFLAGS} ${MACROS} -o${PAGES}
6143334Syokota.endfor
6232822SyokotaSOELIM?=	soelim
6332822SyokotaTBL?=		tbl
6432822Syokota
6532822SyokotaDOC?=		paper
6632822SyokotaLPR?=		lpr
6732822Syokota
6832822Syokota.if defined(USE_EQN)
6932822SyokotaTRFLAGS+=	-e
7032822Syokota.endif
7132822Syokota.if defined(USE_PIC)
7232822SyokotaTRFLAGS+=	-p
7332822Syokota.endif
7432822Syokota.if defined(USE_REFER)
7543334SyokotaTRFLAGS+=	-R
7643334Syokota.endif
7732822Syokota.if defined(USE_SOELIM)
7832822SyokotaTRFLAGS+=	-I${SRCDIR}
7932822Syokota.endif
8043334Syokota.if defined(USE_TBL)
8132822SyokotaTRFLAGS+=	-t
8232822Syokota.endif
8343334Syokota
8432822SyokotaDCOMPRESS_EXT?=	${COMPRESS_EXT}
8532822SyokotaDCOMPRESS_CMD?=	${COMPRESS_CMD}
8632822Syokota.for _dev in ${PRINTERDEVICE:Mhtml}
8732822SyokotaDFILE.html=	${DOC}.html
8832822Syokota.endfor
8932822Syokota.for _dev in ${PRINTERDEVICE:Nhtml}
9043334Syokota.if defined(NODOCCOMPRESS)
9132822SyokotaDFILE.${_dev}=	${DOC}.${_dev}
9232822Syokota.else
9332822SyokotaDFILE.${_dev}=	${DOC}.${_dev}${DCOMPRESS_EXT}
9432822Syokota.endif
9532822Syokota.endfor
9632822Syokota
9732822SyokotaPAGES?=		1-
9874119Sache
9932822SyokotaUNROFF?=	unroff
10032822SyokotaHTML_SPLIT?=	yes
10132822SyokotaUNROFFFLAGS?=	-fhtml
10232822Syokota.if ${HTML_SPLIT} == "yes"
10332822SyokotaUNROFFFLAGS+=	split=1
10432822Syokota.endif
10532822Syokota
10632822Syokota# Compatibility mode flag for groff.  Use this when formatting documents with
10732822Syokota# Berkeley me macros (orig_me(7)).
10874119SacheCOMPAT?=	-C
10932822Syokota
11043334Syokota.PATH: ${.CURDIR} ${SRCDIR}
11132822Syokota
11232822Syokota.for _dev in ${PRINTERDEVICE}
11332822Syokotaall: ${DFILE.${_dev}}
11443334Syokota.endfor
11532822Syokota
11632822Syokota.if !target(print)
11732822Syokota.for _dev in ${PRINTERDEVICE}
11832822Syokotaprint: ${DFILE.${_dev}}
11932822Syokota.endfor
12032822Syokotaprint:
12132822Syokota.for _dev in ${PRINTERDEVICE}
12232822Syokota.if defined(NODOCCOMPRESS)
12332822Syokota	${LPR} ${DFILE.${_dev}}
12432822Syokota.else
12532822Syokota	${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR}
12632822Syokota.endif
12732822Syokota.endfor
12832822Syokota.endif
12932822Syokota
13032822Syokota.for _dev in ${PRINTERDEVICE:Nascii:Nps:Nhtml}
13132822SyokotaCLEANFILES+=	${DOC}.${_dev} ${DOC}.${_dev}${DCOMPRESS_EXT}
13232822Syokota.endfor
13332822SyokotaCLEANFILES+=	${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
13432822Syokota		${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
13532822Syokota		${DOC}.html ${DOC}-*.html
13632822Syokota
13732822Syokotarealinstall:
13832822Syokota.for _dev in ${PRINTERDEVICE:Mhtml}
13932822Syokota	cd ${SRCDIR}; \
140	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
141	    ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
142.endfor
143.for _dev in ${PRINTERDEVICE:Nhtml}
144	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
145	    ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}
146.endfor
147
148spell: ${SRCS}
149	(cd ${.CURDIR}; spell ${SRCS} ) | sort | \
150		comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
151
152BINDIR?=	/usr/share/doc
153BINMODE=	444
154
155SRCDIR?=	${.CURDIR}
156
157.if defined(EXTRA) && !empty(EXTRA)
158_stamp.extra: ${EXTRA}
159	touch ${.TARGET}
160.endif
161
162CLEANFILES+=	_stamp.extra
163.for _dev in ${PRINTERDEVICE:Nhtml}
164.if !target(${DFILE.${_dev}})
165.if target(_stamp.extra)
166${DFILE.${_dev}}: _stamp.extra
167.endif
168${DFILE.${_dev}}: ${SRCS}
169.if defined(NODOCCOMPRESS)
170	${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET}
171.else
172	${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET}
173.endif
174.endif
175.endfor
176
177.for _dev in ${PRINTERDEVICE:Mhtml}
178.if !target(${DFILE.html})
179.if target(_stamp.extra)
180${DFILE.html}: _stamp.extra
181.endif
182${DFILE.html}: ${SRCS}
183.if defined(MACROS) && !empty(MACROS)
184	cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
185	    document=${DOC} ${SRCS}
186.else # unroff(1) requires a macro package as an argument
187	cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \
188	    document=${DOC} ${SRCS}
189.else
190.endif
191.endif
192.endfor
193
194DISTRIBUTION?=	doc
195
196.include <bsd.obj.mk>
197