bsd.doc.mk revision 94940
1#	from: @(#)bsd.doc.mk	5.3 (Berkeley) 1/2/91
2# $FreeBSD: head/share/mk/bsd.doc.mk 94940 2002-04-17 13:49:29Z ru $
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} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
107		${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
108.else
109	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
110		${DFILE} ${DESTDIR}${BINDIR}/${VOLUME}
111.endif
112
113install:	beforeinstall realinstall afterinstall
114
115.if !target(beforeinstall)
116beforeinstall:
117
118.endif
119.if !target(afterinstall)
120afterinstall:
121
122.endif
123
124DISTRIBUTION?=	doc
125.if !target(distribute)
126distribute:
127.for dist in ${DISTRIBUTION}
128	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
129.endfor
130.endif
131
132spell: ${SRCS}
133	(cd ${.CURDIR};  spell ${SRCS} ) | sort | \
134		comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
135
136BINDIR?=	/usr/share/doc
137BINMODE=        444
138
139SRCDIR?=	${.CURDIR}
140
141.if !target(${DFILE})
142_stamp.extraobjs: ${EXTRA} ${OBJS}
143	touch ${.TARGET}
144CLEANFILES+=	_stamp.extraobjs
145${DFILE}: ${SRCS} _stamp.extraobjs
146.if ${PRINTERDEVICE} == "html"
147	cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
148	    document=${DOC} ${SRCS}
149.elif defined(USE_SOELIMPP)
150	${SOELIMPP} ${.ALLSRC:N_stamp.extraobjs} | ${ROFF} | \
151	    ${DCOMPRESS_CMD} > ${.TARGET}
152.else
153	(cd ${SRCDIR}; ${ROFF} ${.ALLSRC:N_stamp.extraobjs}) | \
154	    ${DCOMPRESS_CMD} > ${.TARGET}
155.endif
156.endif
157
158.if !target(all-man)
159all-man:
160.endif
161
162.if !target(maninstall)
163maninstall:
164.endif
165
166.if !target(regress)
167regress:
168.endif
169
170.include <bsd.obj.mk>
171