bsd.doc.mk revision 25710
1#	from: @(#)bsd.doc.mk	5.3 (Berkeley) 1/2/91
2#	$Id: bsd.doc.mk,v 1.36 1997/04/04 01:25:32 mpp 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
18PRINTERDEVICE?=	ascii
19
20BIB?=		bib
21EQN?=		eqn -T${PRINTERDEVICE}
22GREMLIN?=	grn
23GRIND?=		vgrind -f
24INDXBIB?=	indxbib
25PIC?=		pic
26REFER?=		refer
27.if ${PRINTERDEVICE} == "ascii"
28ROFF?=          groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES}
29.else
30ROFF?=		groff ${TRFLAGS} ${MACROS} -o${PAGES}
31.endif
32SOELIM?=	soelim
33SOELIMPP=	sed ${SOELIMPPARGS}
34SOELIMPPARGS0=	${SRCS} ${EXTRA}
35SOELIMPPARGS1=	${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\	][\\ \\	]*\)\(/}
36SOELIMPPARGS2=	${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/}
37SOELIMPPARGS=	${SOELIMPPARGS2:S/\\'/'/g}
38TBL?=		tbl
39
40DOC?=		paper
41LPR?=		lpr
42
43TRFLAGS+=	-T${PRINTERDEVICE}
44.if defined(USE_EQN)
45TRFLAGS+=	-e
46.endif
47.if defined(USE_TBL)
48TRFLAGS+=	-t
49.endif
50.if defined(USE_PIC)
51TRFLAGS+=	-p
52.endif
53.if defined(USE_SOELIM)
54TRFLAGS+=	-s
55.endif
56.if defined(USE_REFER)
57TRFLAGS+=	-R
58.endif
59
60DCOMPRESS_EXT?=	${COMPRESS_EXT}
61.if defined(NODOCCOMPRESS) || ${PRINTERDEVICE} == "html"
62DFILE=	${DOC}.${PRINTERDEVICE}
63DCOMPRESS_CMD=	cat
64.else
65DFILE=	${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT}
66DCOMPRESS_CMD?=	${COMPRESS_CMD}
67.endif
68
69PAGES?=		1-
70
71UNROFF?=	unroff
72HTML_SPLIT?=	yes
73UNROFFFLAGS?=	-fhtml
74.if ${HTML_SPLIT} == "yes"
75UNROFFFLAGS+=	split=1
76.endif
77
78# Compatibility mode flag for groff.  Use this when formatting documents with
79# Berkeley me macros.
80COMPAT?=	-C
81
82.PATH: ${.CURDIR} ${SRCDIR}
83
84.MAIN:	all
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
96CLEANFILES+=	${DOC}.${PRINTERDEVICE} \
97		${DOC}.${PRINTERDEVICE}${DCOMPRESS_EXT} \
98		${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
99		${DOC}.ps ${DOC}.ps${DCOMPRESS_EXT} \
100		${DOC}.html ${DOC}-*.html
101
102
103FILES?=	${SRCS}
104realinstall:
105.if ${PRINTERDEVICE} == "html"
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	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
128.endif
129
130spell: ${SRCS}
131	(cd ${.CURDIR};  spell ${SRCS} ) | sort | \
132		comm -23 - ${.CURDIR}/spell.ok > ${DOC}.spell
133
134BINDIR?=	/usr/share/doc
135BINMODE=        444
136
137SRCDIR?=	${.CURDIR}
138
139.if !target(${DFILE})
140.if ${PRINTERDEVICE} == "html"
141${DFILE}:	${SRCS} ${EXTRA} ${OBJS}
142	cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
143		document=${.OBJDIR}/${DOC} ${SRCS}
144.else
145
146${DFILE}::	${SRCS} ${EXTRA} ${OBJS}
147# XXX ${.ALLSRC} doesn't work unless there are a lot of .PATH.foo statements.
148ALLSRCS=	${SRCS:S;^;${SRCDIR}/;}
149${DFILE}::	${SRCS}
150.if defined(USE_SOELIMPP)
151	${SOELIMPP} ${ALLSRCS} | ${ROFF} | ${DCOMPRESS_CMD} > ${.TARGET}
152.else
153	(cd ${SRCDIR}; ${ROFF} ${.ALLSRC}) | ${DCOMPRESS_CMD} > ${.TARGET}
154.endif
155.else
156.if !defined(NODOCCOMPRESS)
157${DFILE}:	${DOC}.${PRINTERDEVICE}
158	${DCOMPRESS_CMD} ${DOC}.${PRINTERDEVICE} > ${.TARGET}
159.endif
160.endif
161.endif
162
163.if !target(depend)
164depend:
165.endif
166
167.if !target(maninstall)
168maninstall:
169.endif
170
171.include <bsd.dep.mk>
172.include <bsd.obj.mk>
173