xref: /netbsd/distrib/notes/Makefile.inc (revision c4a72b64)
1#	$NetBSD: Makefile.inc,v 1.31 2002/07/21 08:14:46 lukem Exp $
2#
3
4# Ross Harvey <ross@netbsd.org>
5
6.include <bsd.own.mk>	# So we get /etc/mk.conf vars.
7.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
8
9# Whether or not to regenerate tables of contents
10#
11MKTOCS?=yes
12
13M?=	${.CURDIR:T}
14COMMON=	${.CURDIR}/../common
15
16MAIN=	${COMMON}/main ${COMMON}/macros ${EXTRA}
17TARG=	INSTALL
18TARGS=	${TARG}.ps ${TARG}.txt ${TARG}.html ${TARG}.more
19TOCS=	${TARG}.PostScript.toc ${TARG}.ASCII.toc ${TARG}.HTML.toc \
20	${TARG}.more.toc
21SRCS=	${MAIN} whatis ${COMMON}/contents hardware xfer prep \
22	${.CURDIR}/install ${COMMON}/postinstall upgrade \
23	${COMMON}/donations ${COMMON}/legal.common legal \
24	${.CURDIR}/../Makefile.inc ${MERGED_SRCS}
25
26PRESET=	${GFLAGS} -dM=${M} -dV=${DISTRIBVER} -d.CURDIR=${.CURDIR} -r${M}=1
27
28POST_PLAIN= -P-b -P-u -P-o
29
30ARGS_PS=	${PRESET} -dformat=PostScript
31ARGS_TXT=	${PRESET} -dformat=ASCII ${POST_PLAIN} -Tascii -mtty-char
32ARGS_HTML=	${PRESET} -dformat=HTML ${POST_PLAIN} -Tlatin1 -ww
33ARGS_MORE=	${PRESET} -dformat=more -P-h -Tascii -mtty-char
34
35#
36# For example...
37#
38#	.if ri386 ...stuff...
39#	.Ss "Install notes for NetBSD/\*[MACHINE]"
40#
41
42all: ${TARGS}
43
44.if ${MKTOCS} != "no"
45TOC.ps=		${TOCS:M*.PostScript.*}
46TOC.txt=	${TOCS:M*.ASCII.*}
47TOC.html=	${TOCS:M*.HTML.*}
48TOC.more=	${TOCS:M*.more.*}
49.endif
50
51
52${TARG}.ps: ${SRCS} ${TOC.ps}
53	${GROFF} ${ARGS_PS}   -mdoc      ${MAIN} > $@
54
55${TARG}.pdf: ${TARG}.ps
56	ps2pdf ${TARG}.ps $@
57
58${TARG}.txt: ${SRCS} ${TOC.txt}
59	${GROFF} ${ARGS_TXT}  -mdoc      ${MAIN} > $@
60
61${TARG}.html: ${SRCS} ${TOC.html}
62	${GROFF} ${ARGS_HTML} -mdoc2html ${MAIN} > $@
63
64${TARG}.more: ${SRCS} ${TOC.more}
65	${GROFF} ${ARGS_MORE} -mdoc      ${MAIN} > $@
66
67
68# Rules to build the table of contents (.toc) files.
69# They are generated twice to take into account the
70# space taken by the TOC itself.
71#
72
73TOCPROC=	   2>&1 >/dev/null |\
74           sed -n '/^\.Ti/{s/ \([A-Za-z]\)/ "\1/; s/ *$$/"/; p; }'
75
76${TARG}.PostScript.toc: ${SRCS}
77	${GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
78	mv -f $@.tmp $@
79	${GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
80	mv -f $@.tmp $@
81
82${TARG}.ASCII.toc: ${SRCS}
83	${GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
84	mv -f $@.tmp $@
85	${GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
86	mv -f $@.tmp $@
87
88${TARG}.HTML.toc: ${SRCS}
89	${GROFF} -dTOC=1 ${ARGS_HTML} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
90	mv -f $@.tmp $@
91	${GROFF} -dTOC=1 ${ARGS_HTML} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
92	mv -f $@.tmp $@
93
94${TARG}.more.toc: ${SRCS}
95	${GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
96	mv -f $@.tmp $@
97	${GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} ${TOCPROC} > $@.tmp
98	mv -f $@.tmp $@
99
100
101release: check_RELEASEDIR .WAIT ${TARGS}
102	${RELEASE_INSTALL} ${TARGS} ${RELEASEDIR}/.
103
104cleannotes:
105	rm -f [Ee]rrs mklog core *.core ${TARGS} ${TOCS} \
106	    ${TOCS:S/.toc$/.toc.tmp/g}
107
108clean cleandir distclean: cleannotes
109