bsd.doc.mk revision 30896
1#	from: @(#)bsd.doc.mk	5.3 (Berkeley) 1/2/91
2#	$Id: bsd.doc.mk,v 1.39 1997/11/01 19:45:02 wosch Exp $
3#
4# The include file <bsd.doc.mk> handles installing BSD troff documents.
5# <bsd.prog.mk> includes the include files <bsd.dep.mk> and <bsd.obj.mk>.
6#
7#
8# +++ variables +++
9#
10# LPR		Printer command. [lpr]
11#
12# 	[incomplete]
13#
14# +++ targets +++
15#
16# 	[incomplete]
17
18.if exists(${.CURDIR}/../Makefile.inc)
19.include "${.CURDIR}/../Makefile.inc"
20.endif
21
22PRINTERDEVICE?=	ascii
23
24BIB?=		bib
25EQN?=		eqn -T${PRINTERDEVICE}
26GREMLIN?=	grn
27GRIND?=		vgrind -f
28INDXBIB?=	indxbib
29PIC?=		pic
30REFER?=		refer
31.if ${PRINTERDEVICE} == "ascii"
32ROFF?=          groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES}
33.else
34ROFF?=		groff ${TRFLAGS} ${MACROS} -o${PAGES}
35.endif
36SOELIM?=	soelim
37SOELIMPP=	sed ${SOELIMPPARGS}
38SOELIMPPARGS0=	${SRCS} ${EXTRA}
39SOELIMPPARGS1=	${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\	][\\ \\	]*\)\(/}
40SOELIMPPARGS2=	${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/}
41SOELIMPPARGS=	${SOELIMPPARGS2:S/\\'/'/g}
42TBL?=		tbl
43
44DOC?=		paper
45LPR?=		lpr
46
47TRFLAGS+=	-T${PRINTERDEVICE}
48.if defined(USE_EQN)
49TRFLAGS+=	-e
50.endif
51.if defined(USE_TBL)
52TRFLAGS+=	-t
53.endif
54.if defined(USE_PIC)
55TRFLAGS+=	-p
56.endif
57.if defined(USE_SOELIM)
58TRFLAGS+=	-s
59.endif
60.if defined(USE_REFER)
61TRFLAGS+=	-R
62.endif
63
64DCOMPRESS_EXT?=	${COMPRESS_EXT}
65.if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html"
66DFILE=	${DOC}.${PRINTERDEVICE}
67DCOMPRESS_CMD=	cat
68.else
69DFILE=	${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
70DCOMPRESS_CMD?=	${COMPRESS_CMD}
71.endif
72
73PAGES?=		1-
74
75UNROFF?=	unroff
76HTML_SPLIT?=	yes
77UNROFFFLAGS?=	-fhtml
78.if ${HTML_SPLIT} == "yes"
79UNROFFFLAGS+=	split=1
80.endif
81
82# Compatibility mode flag for groff.  Use this when formatting documents with
83# Berkeley me macros.
84COMPAT?=	-C
85
86.PATH: ${.CURDIR} ${SRCDIR}
87
88.MAIN:	all
89all:	${DFILE}
90
91.if !target(print)
92print: ${DFILE}
93.if defined(NODOCCOMPRESS)
94	${LPR} ${DFILE}
95.else
96	${DCOMPRESS_CMD} -d ${DFILE} | ${LPR}
97.endif
98.endif
99
100CLEANFILES+=	${DOC}.${PRINTERDEVICE} \
101		${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT} \
102		${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
103		${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
104		${DOC}.html ${DOC}-*.html
105
106
107FILES?=	${SRCS}
108realinstall:
109.if ${PRINTERDEVICE} == "html"
110	cd ${SRCDIR}; \
111		${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
112		${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
113.else
114	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
115		${DFILE} ${DESTDIR}${BINDIR}/${VOLUME}
116.endif
117
118install:	beforeinstall realinstall afterinstall
119
120.if !target(beforeinstall)
121beforeinstall:
122
123.endif
124.if !target(afterinstall)
125afterinstall:
126
127.endif
128
129DISTRIBUTION?=	doc
130.if !target(distribute)
131distribute:
132.for dist in ${DISTRIBUTION}
133	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
134.endfor
135.endif
136
137spell: ${SRCS}
138	(cd ${.CURDIR};  spell ${SRCS} ) | sort | \
139		comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
140
141BINDIR?=	/usr/share/doc
142BINMODE=        444
143
144SRCDIR?=	${.CURDIR}
145
146.if !target(${DFILE})
147.if ${PRINTERDEVICE} == "html"
148${DFILE}:	${SRCS} ${EXTRA} ${OBJS}
149	cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
150		document=${DOC} ${SRCS}
151.else
152
153${DFILE}::	${SRCS} ${EXTRA} ${OBJS}
154# XXX ${.ALLSRC} doesn't work unless there are a lot of .PATH.foo statements.
155ALLSRCS=	${SRCS:S;^;${SRCDIR}/;}
156${DFILE}::	${SRCS}
157.if defined(USE_SOELIMPP)
158	${SOELIMPP} ${ALLSRCS} | ${ROFF} | ${DCOMPRESS_CMD} > ${.TARGET}
159.else
160	(cd ${SRCDIR}; ${ROFF} ${.ALLSRC}) | ${DCOMPRESS_CMD} > ${.TARGET}
161.endif
162.else
163.if !defined(NODOCCOMPRESS)
164${DFILE}:	${DOC}.${PRINTERDEVICE}
165	${DCOMPRESS_CMD} ${DOC}.${PRINTERDEVICE} > ${.TARGET}
166.endif
167.endif
168.endif
169
170.if !target(depend)
171depend:
172.endif
173
174.if !target(maninstall)
175maninstall:
176.endif
177
178.include <bsd.dep.mk>
179.include <bsd.obj.mk>
180