xref: /freebsd/share/mk/bsd.man.mk (revision 17ee9d00bc1ae1e598c38f25826f861e4bc6c3ce)
1#	from: @(#)bsd.man.mk	5.2 (Berkeley) 5/11/90
2#	$Id: bsd.man.mk,v 1.3 1994/08/28 15:37:40 bde Exp $
3
4.if exists(${.CURDIR}/../Makefile.inc)
5.include "${.CURDIR}/../Makefile.inc"
6.endif
7
8MANGRP?=	bin
9MANOWN?=	bin
10MANMODE?=	444
11
12MANDIR?=	/usr/share/man/man
13MANSRC?=	${.CURDIR}
14MINSTALL=	${INSTALL}  ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
15
16MCOMPRESS=	gzip -f
17BASENAME=	basename
18ZEXTENSION=	.gz
19.if !defined(NOMANCOMPRESS)
20ZEXT=		${ZEXTENSION}
21.else
22ZEXT=
23.endif
24
25MANALL=		${MAN1} ${MAN2} ${MAN3} ${MAN3F} ${MAN4} ${MAN5}	\
26		${MAN6} ${MAN7} ${MAN8}
27
28maninstall: ${MANDEPEND}
29.if defined(MAN1) && !empty(MAN1)
30	(cd ${MANSRC}; ${MINSTALL} ${MAN1} ${DESTDIR}${MANDIR}1${MANSUBDIR})
31.endif
32.if defined(MAN2) && !empty(MAN2)
33	(cd ${MANSRC}; ${MINSTALL} ${MAN2} ${DESTDIR}${MANDIR}2${MANSUBDIR})
34.endif
35.if defined(MAN3) && !empty(MAN3)
36	(cd ${MANSRC}; ${MINSTALL} ${MAN3} ${DESTDIR}${MANDIR}3${MANSUBDIR})
37.endif
38.if defined(MAN3F) && !empty(MAN3F)
39	(cd ${MANSRC}; ${MINSTALL} ${MAN3F} ${DESTDIR}${MANDIR}3f${MANSUBDIR})
40.endif
41.if defined(MAN4) && !empty(MAN4)
42	(cd ${MANSRC}; ${MINSTALL} ${MAN4} ${DESTDIR}${MANDIR}4${MANSUBDIR})
43.endif
44.if defined(MAN5) && !empty(MAN5)
45	(cd ${MANSRC}; ${MINSTALL} ${MAN5} ${DESTDIR}${MANDIR}5${MANSUBDIR})
46.endif
47.if defined(MAN6) && !empty(MAN6)
48	(cd ${MANSRC}; ${MINSTALL} ${MAN6} ${DESTDIR}${MANDIR}6${MANSUBDIR})
49.endif
50.if defined(MAN7) && !empty(MAN7)
51	(cd ${MANSRC}; ${MINSTALL} ${MAN7} ${DESTDIR}${MANDIR}7${MANSUBDIR})
52.endif
53.if defined(MAN8) && !empty(MAN8)
54	(cd ${MANSRC}; ${MINSTALL} ${MAN8} ${DESTDIR}${MANDIR}8${MANSUBDIR})
55.endif
56
57# by default all pages are compressed
58# we don't handle .so's yet
59.if !empty(MANALL:S/ //g)
60.if !defined(NOMANCOMPRESS)
61	@set ${MANALL} ;						\
62	while test $$# -ge 1; do					\
63		name=`${BASENAME} $$1`;					\
64		sect=`expr $$name : '.*\.\([^.]*\)'`;			\
65		${ECHO} "compressing in"				\
66			"${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}:"	\
67			"$$name -> $${name}${ZEXT}";			\
68		${MCOMPRESS} ${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name ; \
69		shift ;							\
70	done ; true
71.else
72# we are installing uncompressed pages, so nuke any compressed pages
73	@set ${MANALL} ;						\
74	while test $$# -ge 1; do					\
75		name=`${BASENAME} $$1`;					\
76		sect=`expr $$name : '.*\.\([^.]*\)'`;			\
77		rm -f ${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name${ZEXTENSION};\
78		shift ;							\
79	done ; true
80.endif
81.endif
82
83.if defined(MLINKS) && !empty(MLINKS)
84	@set ${MLINKS}; \
85	while test $$# -ge 2; do \
86		name=$$1; \
87		shift; \
88		sect=`expr $$name : '.*\.\([^.]*\)'`; \
89		dir=${DESTDIR}${MANDIR}$$sect; \
90		l=$${dir}${MANSUBDIR}/$$name; \
91		name=$$1; \
92		shift; \
93		sect=`expr $$name : '.*\.\([^.]*\)'`; \
94		dir=${DESTDIR}${MANDIR}$$sect; \
95		t=$${dir}${MANSUBDIR}/$$name; \
96		${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
97		rm -f $${t}${ZEXTENSION}; \
98		rm -f $${t}; \
99		ln $${l}${ZEXT} $${t}${ZEXT}; \
100	done; true
101.endif
102