xref: /netbsd-src/share/mk/bsd.man.mk (revision 705ee976cfe4e85b18732519865b1f7b6cbb2322)
1#	$NetBSD: bsd.man.mk,v 1.14 1994/06/30 05:31:15 cgd Exp $
2#	@(#)bsd.man.mk	5.2 (Berkeley) 5/11/90
3
4.if !target(.MAIN)
5.if exists(${.CURDIR}/../Makefile.inc)
6.include "${.CURDIR}/../Makefile.inc"
7.endif
8
9.MAIN: all
10.endif
11
12.SUFFIXES: .0 .1 .2 .3 .4 .5 .6 .7 .8
13
14.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
15	@echo "nroff -mandoc ${.IMPSRC} > ${.TARGET}"
16	@nroff -mandoc ${.IMPSRC} > ${.TARGET} || ( rm -f ${.TARGET} ; false )
17
18
19MINSTALL=	install ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
20
21maninstall:
22.if defined(MAN1) && !empty(MAN1)
23MANALL+=${MAN1}
24maninstall: man1install
25man1install:
26	${MINSTALL} ${MAN1} ${DESTDIR}${MANDIR}1${MANSUBDIR}
27.endif
28.if defined(MAN2) && !empty(MAN2)
29MANALL+=${MAN2}
30maninstall: man2install
31man2install:
32	${MINSTALL} ${MAN2} ${DESTDIR}${MANDIR}2${MANSUBDIR}
33.endif
34.if defined(MAN3) && !empty(MAN3)
35MANALL+=${MAN3}
36maninstall: man3install
37man3install:
38	${MINSTALL} ${MAN3} ${DESTDIR}${MANDIR}3${MANSUBDIR}
39.endif
40.if defined(MAN3F) && !empty(MAN3F)
41MANALL+=${MAN3F}
42maninstall: man3finstall
43man3finstall:
44	${MINSTALL} ${MAN3F} ${DESTDIR}${MANDIR}3f${MANSUBDIR}
45.endif
46.if defined(MAN4) && !empty(MAN4)
47MANALL+=${MAN4}
48maninstall: man4install
49man4install:
50	${MINSTALL} ${MAN4} ${DESTDIR}${MANDIR}4${MANSUBDIR}
51.endif
52.if defined(MAN5) && !empty(MAN5)
53MANALL+=${MAN5}
54maninstall: man5install
55man5install:
56	${MINSTALL} ${MAN5} ${DESTDIR}${MANDIR}5${MANSUBDIR}
57.endif
58.if defined(MAN6) && !empty(MAN6)
59MANALL+=${MAN6}
60maninstall: man6install
61man6install:
62	${MINSTALL} ${MAN6} ${DESTDIR}${MANDIR}6${MANSUBDIR}
63.endif
64.if defined(MAN7) && !empty(MAN7)
65MANALL+=${MAN7}
66maninstall: man7install
67man7install:
68	${MINSTALL} ${MAN7} ${DESTDIR}${MANDIR}7${MANSUBDIR}
69.endif
70.if defined(MAN8) && !empty(MAN8)
71MANALL+=${MAN8}
72maninstall: man8install
73man8install:
74	${MINSTALL} ${MAN8} ${DESTDIR}${MANDIR}8${MANSUBDIR}
75.endif
76.if defined(MLINKS) && !empty(MLINKS)
77maninstall: manlinkinstall
78manlinkinstall:
79	@set ${MLINKS}; \
80	while test $$# -ge 2; do \
81		name=$$1; \
82		shift; \
83		dir=${DESTDIR}${MANDIR}`expr $$name : '.*\.\(.*\)'`; \
84		l=$${dir}${MANSUBDIR}/`expr $$name : '\(.*\)\..*'`.0; \
85		name=$$1; \
86		shift; \
87		dir=${DESTDIR}${MANDIR}`expr $$name : '.*\.\(.*\)'`; \
88		t=$${dir}${MANSUBDIR}/`expr $$name : '\(.*\)\..*'`.0; \
89		echo $$t -\> $$l; \
90		rm -f $$t; \
91		ln $$l $$t; \
92	done; true
93.endif
94
95.if defined(MANALL)
96all: ${MANALL}
97
98cleandir: cleanman
99cleanman:
100	rm -f ${MANALL}
101.endif
102