xref: /freebsd/share/mk/bsd.doc.mk (revision d2893b161bbea64e099654c0dd78073cfb5667b0)
1#	from: @(#)bsd.doc.mk	5.3 (Berkeley) 1/2/91
2# $FreeBSD$
3#
4# The include file <bsd.doc.mk> handles installing BSD troff documents.
5#
6#
7# +++ variables +++
8#
9# LPR		Printer command. [lpr]
10#
11# 	[incomplete]
12#
13# +++ targets +++
14#
15# 	[incomplete]
16
17.include <bsd.init.mk>
18
19PRINTERDEVICE?=	ascii
20
21BIB?=		bib
22EQN?=		eqn -T${PRINTERDEVICE}
23GREMLIN?=	grn
24GRIND?=		vgrind -f
25INDXBIB?=	indxbib
26PIC?=		pic
27REFER?=		refer
28.if ${PRINTERDEVICE} == "ascii"
29ROFF?=          groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES}
30.else
31ROFF?=		groff ${TRFLAGS} ${MACROS} -o${PAGES}
32.endif
33SOELIM?=	soelim
34SOELIMPP=	sed ${SOELIMPPARGS}
35SOELIMPPARGS0=	${SRCS} ${EXTRA}
36SOELIMPPARGS1=	${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\	][\\ \\	]*\)\(/}
37SOELIMPPARGS2=	${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/}
38SOELIMPPARGS=	${SOELIMPPARGS2:S/\\'/'/g}
39TBL?=		tbl
40
41DOC?=		paper
42LPR?=		lpr
43
44TRFLAGS+=	-T${PRINTERDEVICE}
45.if defined(USE_EQN)
46TRFLAGS+=	-e
47.endif
48.if defined(USE_TBL)
49TRFLAGS+=	-t
50.endif
51.if defined(USE_PIC)
52TRFLAGS+=	-p
53.endif
54.if defined(USE_SOELIM)
55TRFLAGS+=	-s
56.endif
57.if defined(USE_REFER)
58TRFLAGS+=	-R
59.endif
60
61DCOMPRESS_EXT?=	${COMPRESS_EXT}
62.if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html"
63DFILE=	${DOC}.${PRINTERDEVICE}
64DCOMPRESS_CMD=	cat
65.else
66DFILE=	${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
67DCOMPRESS_CMD?=	${COMPRESS_CMD}
68.endif
69
70PAGES?=		1-
71
72UNROFF?=	unroff
73HTML_SPLIT?=	yes
74UNROFFFLAGS?=	-fhtml
75.if ${HTML_SPLIT} == "yes"
76UNROFFFLAGS+=	split=1
77.endif
78
79# Compatibility mode flag for groff.  Use this when formatting documents with
80# Berkeley me macros.
81COMPAT?=	-C
82
83.PATH: ${.CURDIR} ${SRCDIR}
84
85all:	${DFILE}
86
87.if !target(print)
88print: ${DFILE}
89.if defined(NODOCCOMPRESS)
90	${LPR} ${DFILE}
91.else
92	${DCOMPRESS_CMD} -d ${DFILE} | ${LPR}
93.endif
94.endif
95
96.if ${PRINTERDEVICE} != "ascii" && ${PRINTERDEVICE} != "ps"
97CLEANFILES+=	${DOC}.${PRINTERDEVICE} ${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
98.endif
99CLEANFILES+=	${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
100		${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
101		${DOC}.html ${DOC}-*.html
102
103realinstall:
104.if ${PRINTERDEVICE} == "html"
105	cd ${SRCDIR}; \
106		${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
107		${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
108.else
109	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
110		${DFILE} ${DESTDIR}${BINDIR}/${VOLUME}
111.endif
112
113spell: ${SRCS}
114	(cd ${.CURDIR};  spell ${SRCS} ) | sort | \
115		comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
116
117BINDIR?=	/usr/share/doc
118BINMODE=        444
119
120SRCDIR?=	${.CURDIR}
121
122.if !target(${DFILE})
123_stamp.extraobjs: ${EXTRA} ${OBJS}
124	touch ${.TARGET}
125CLEANFILES+=	_stamp.extraobjs
126${DFILE}: ${SRCS} _stamp.extraobjs
127.if ${PRINTERDEVICE} == "html"
128	cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
129	    document=${DOC} ${SRCS}
130.elif defined(USE_SOELIMPP)
131	${SOELIMPP} ${.ALLSRC:N_stamp.extraobjs} | ${ROFF} | \
132	    ${DCOMPRESS_CMD} > ${.TARGET}
133.else
134	(cd ${SRCDIR}; ${ROFF} ${.ALLSRC:N_stamp.extraobjs}) | \
135	    ${DCOMPRESS_CMD} > ${.TARGET}
136.endif
137.endif
138
139DISTRIBUTION?=	doc
140
141.include <bsd.obj.mk>
142