xref: /freebsd/share/mk/bsd.doc.mk (revision 71fe318b852b8dfb3e799cb12ef184750f7f8eac)
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
34TBL?=		tbl
35
36DOC?=		paper
37LPR?=		lpr
38
39TRFLAGS+=	-T${PRINTERDEVICE}
40.if defined(USE_EQN)
41TRFLAGS+=	-e
42.endif
43.if defined(USE_PIC)
44TRFLAGS+=	-p
45.endif
46.if defined(USE_REFER)
47TRFLAGS+=	-R
48.endif
49.if defined(USE_SOELIM)
50TRFLAGS+=	-I${SRCDIR}
51.endif
52.if defined(USE_TBL)
53TRFLAGS+=	-t
54.endif
55
56DCOMPRESS_EXT?=	${COMPRESS_EXT}
57.if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html"
58DFILE=		${DOC}.${PRINTERDEVICE}
59.else
60DFILE=		${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
61DCOMPRESS_CMD?=	${COMPRESS_CMD}
62.endif
63
64PAGES?=		1-
65
66UNROFF?=	unroff
67HTML_SPLIT?=	yes
68UNROFFFLAGS?=	-fhtml
69.if ${HTML_SPLIT} == "yes"
70UNROFFFLAGS+=	split=1
71.endif
72
73# Compatibility mode flag for groff.  Use this when formatting documents with
74# Berkeley me macros (orig_me(7)).
75COMPAT?=	-C
76
77.PATH: ${.CURDIR} ${SRCDIR}
78
79all: ${DFILE}
80
81.if !target(print)
82print: ${DFILE}
83.if defined(NODOCCOMPRESS)
84	${LPR} ${DFILE}
85.else
86	${DCOMPRESS_CMD} -d ${DFILE} | ${LPR}
87.endif
88.endif
89
90.if ${PRINTERDEVICE} != "ascii" && ${PRINTERDEVICE} != "ps"
91CLEANFILES+=	${DOC}.${PRINTERDEVICE} ${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
92.endif
93CLEANFILES+=	${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
94		${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
95		${DOC}.html ${DOC}-*.html
96
97realinstall:
98.if ${PRINTERDEVICE} == "html"
99	cd ${SRCDIR}; \
100	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
101	    ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
102.else
103	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
104	    ${DFILE} ${DESTDIR}${BINDIR}/${VOLUME}
105.endif
106
107spell: ${SRCS}
108	(cd ${.CURDIR}; spell ${SRCS} ) | sort | \
109		comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
110
111BINDIR?=	/usr/share/doc
112BINMODE=	444
113
114SRCDIR?=	${.CURDIR}
115
116.if !target(${DFILE})
117.if defined(EXTRA) && !empty(EXTRA)
118_stamp.extra: ${EXTRA}
119	touch ${.TARGET}
120CLEANFILES+=	_stamp.extra
121${DFILE}: _stamp.extra
122.endif
123${DFILE}: ${SRCS}
124.if ${PRINTERDEVICE} == "html"
125	cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
126	    document=${DOC} ${SRCS}
127.elif defined(NODOCCOMPRESS)
128.if defined(CD_HACK)
129	(cd ${CD_HACK}; ${ROFF} ${.ALLSRC:N_stamp.extra}) > ${.TARGET}
130.else
131	${ROFF} ${.ALLSRC:N_stamp.extra} > ${.TARGET}
132.endif
133.else
134.if defined(CD_HACK)
135	(cd ${CD_HACK}; ${ROFF} ${.ALLSRC:N_stamp.extra}) | \
136	    ${DCOMPRESS_CMD} > ${.TARGET}
137.else
138	${ROFF} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET}
139.endif
140.endif
141.endif
142
143DISTRIBUTION?=	doc
144
145.include <bsd.obj.mk>
146