xref: /netbsd/share/mk/bsd.inc.mk (revision c4a72b64)
1#	$NetBSD: bsd.inc.mk,v 1.23 2002/10/22 18:48:27 perry Exp $
2
3##### Basic targets
4.PHONY:		incinstall
5includes:	${INCS} incinstall
6
7##### Install rules
8incinstall::	# ensure existence
9
10# -c is forced on here, in order to preserve modtimes for "make depend"
11__incinstall: .USE
12	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
13	    (echo "${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
14		-m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}" && \
15	     ${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
16		-m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET})
17
18.for F in ${INCS:O:u}
19_FDIR:=		${INCSDIR_${F:C,/,_,g}:U${INCSDIR}}	# dir override
20_FNAME:=	${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override
21_F:=		${DESTDIR}${_FDIR}/${_FNAME}		# installed path
22
23.if !defined(UPDATE)
24${_F}!		${F} __incinstall			# install rule
25.else
26${_F}:		${F} __incinstall			# install rule
27.endif
28
29incinstall::	${_F}
30.PRECIOUS:	${_F}					# keep if install fails
31.endfor
32
33.undef _FDIR
34.undef _FNAME
35.undef _F
36