xref: /freebsd/share/mk/bsd.man.mk (revision e8f9a07320f6d379fb188c4daa0d7cf5905710ec)
1e8f9a073SBruce Evans#	$Id: bsd.man.mk,v 1.5 1995/10/02 20:01:49 wollman Exp $
2e8f9a073SBruce Evans
3e8f9a073SBruce Evans.if exists(${.CURDIR}/../Makefile.inc)
4e8f9a073SBruce Evans.include "${.CURDIR}/../Makefile.inc"
5e8f9a073SBruce Evans.endif
6afe61c15SRodney W. Grimes
7afe61c15SRodney W. GrimesMANGRP?=	bin
8afe61c15SRodney W. GrimesMANOWN?=	bin
9afe61c15SRodney W. GrimesMANMODE?=	444
10afe61c15SRodney W. Grimes
113585b293SGarrett WollmanMANDIR?=	/usr/share/man/man
123585b293SGarrett WollmanMANSRC?=	${.CURDIR}
133585b293SGarrett WollmanMINSTALL=	${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
14afe61c15SRodney W. Grimes
15e8f9a073SBruce EvansMCOMPRESS=	gzip -c
163585b293SGarrett WollmanZEXTENSION=	.gz
17afe61c15SRodney W. Grimes
18e8f9a073SBruce EvansSECTIONS=	1 2 3 3f 4 5 6 7 8
193585b293SGarrett Wollman
20973f098aSGarrett Wollmanall-man: ${MANDEPEND}
21e8f9a073SBruce Evans
22e8f9a073SBruce Evans.if defined(NOMANCOMPRESS)
23e8f9a073SBruce Evans
24e8f9a073SBruce EvansZEXT=
25e8f9a073SBruce Evans
26e8f9a073SBruce Evans.else
27e8f9a073SBruce Evans
28e8f9a073SBruce EvansZEXT=		${ZEXTENSION}
29e8f9a073SBruce Evans
30e8f9a073SBruce Evans.for sect in ${SECTIONS}
31e8f9a073SBruce Evans.if defined(MAN${sect}) && !empty(MAN${sect})
32e8f9a073SBruce EvansCLEANFILES+=	${MAN${sect}:T:S/$/${ZEXTENSION}/g}
33e8f9a073SBruce Evans.SUFFIXES: .${sect}
34e8f9a073SBruce Evans.PATH.${sect}: ${MANSRC}
35e8f9a073SBruce Evans.for page in ${MAN${sect}}
36e8f9a073SBruce Evans.for target in ${page:T:S/$/${ZEXTENSION}/}
37e8f9a073SBruce Evansall-man: ${target}
38e8f9a073SBruce Evans${target}: ${page}
39e8f9a073SBruce Evans	${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
40e8f9a073SBruce Evans.endfor
41e8f9a073SBruce Evans.endfor
42e8f9a073SBruce Evans.endif
43e8f9a073SBruce Evans.endfor
44e8f9a073SBruce Evans
453585b293SGarrett Wollman.endif
463585b293SGarrett Wollman
47973f098aSGarrett Wollmanmaninstall:
48e8f9a073SBruce Evans.for sect in ${SECTIONS}
49973f098aSGarrett Wollman.if defined(MAN${sect}) && !empty(MAN${sect})
50973f098aSGarrett Wollman.if defined(NOMANCOMPRESS)
51e8f9a073SBruce Evans	${MINSTALL} ${MAN${sect}} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
52973f098aSGarrett Wollman.else
53e8f9a073SBruce Evans	${MINSTALL} ${MAN${sect}:T:S/$/${ZEXTENSION}/g} \
54e8f9a073SBruce Evans		${DESTDIR}${MANDIR}${sect}${MANSUBDIR}
55973f098aSGarrett Wollman.endif
56973f098aSGarrett Wollman.endif
57973f098aSGarrett Wollman.endfor
58e8f9a073SBruce Evans
59afe61c15SRodney W. Grimes.if defined(MLINKS) && !empty(MLINKS)
60afe61c15SRodney W. Grimes	@set ${MLINKS}; \
61afe61c15SRodney W. Grimes	while test $$# -ge 2; do \
62afe61c15SRodney W. Grimes		name=$$1; \
63afe61c15SRodney W. Grimes		shift; \
643585b293SGarrett Wollman		sect=`expr $$name : '.*\.\([^.]*\)'`; \
653585b293SGarrett Wollman		dir=${DESTDIR}${MANDIR}$$sect; \
663585b293SGarrett Wollman		l=$${dir}${MANSUBDIR}/$$name; \
67afe61c15SRodney W. Grimes		name=$$1; \
68afe61c15SRodney W. Grimes		shift; \
693585b293SGarrett Wollman		sect=`expr $$name : '.*\.\([^.]*\)'`; \
703585b293SGarrett Wollman		dir=${DESTDIR}${MANDIR}$$sect; \
713585b293SGarrett Wollman		t=$${dir}${MANSUBDIR}/$$name; \
7280c02d59SBruce Evans		${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
73e8f9a073SBruce Evans		rm -f $${t} $${t}${ZEXTENSION}; \
743585b293SGarrett Wollman		ln $${l}${ZEXT} $${t}${ZEXT}; \
75afe61c15SRodney W. Grimes	done; true
76afe61c15SRodney W. Grimes.endif
77