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