1# $Id: doc.mk,v 1.9 2024/02/19 00:06:19 sjg Exp $
2
3# should be set properly in sys.mk
4_this ?= ${.PARSEFILE:S,bsd.,,}
5
6.if !target(__${_this}__)
7__${_this}__: .NOTMAIN
8
9.include <init.mk>
10
11BIB?=		bib
12EQN?=		eqn
13GREMLIN?=	grn
14GRIND?=		vgrind -f
15INDXBIB?=	indxbib
16PIC?=		pic
17REFER?=		refer
18ROFF?=		groff -M/usr/share/tmac ${MACROS} ${PAGES}
19SOELIM?=	soelim
20TBL?=		tbl
21
22.PATH: ${.CURDIR}
23
24.if !defined(_SKIP_BUILD)
25realbuild: paper.ps
26.endif
27
28.if !target(paper.ps)
29paper.ps: ${SRCS}
30	${ROFF} ${SRCS} > ${.TARGET}
31.endif
32
33.if !target(print)
34print: paper.ps
35	lpr -P${PRINTER} paper.ps
36.endif
37
38.if !target(manpages)
39manpages:
40.endif
41
42.if !target(obj)
43obj:
44.endif
45
46clean cleandir:
47	rm -f paper.* [eE]rrs mklog ${CLEANFILES}
48
49.if ${MK_DOC} == "no"
50install:
51.else
52FILES?=	${SRCS}
53install:
54	test -d ${DESTDIR}${DOCDIR}/${DIR} || \
55	    ${INSTALL} -d ${DOC_INSTALL_OWN} -m ${DIRMODE} ${DESTDIR}${DOCDIR}/${DIR}
56	${INSTALL} ${COPY} ${DOC_INSTALL_OWN} -m ${DOCMODE} \
57	    Makefile ${FILES} ${EXTRA} ${DESTDIR}${DOCDIR}/${DIR}
58.endif
59
60spell: ${SRCS}
61	spell ${SRCS} | sort | comm -23 - spell.ok > paper.spell
62
63.if !empty(DOCOWN)
64DOC_INSTALL_OWN?= -o ${DOCOWN} -g ${DOCGRP}
65.endif
66
67.endif
68