etc/protocols - sync with NetBSD-8
[minix.git] / share / mk / bsd.inc.mk
blob9672743d5a89b89f3ff74e9718288e3cec3b02e4
1 # $NetBSD: bsd.inc.mk,v 1.32 2006/03/16 18:43:34 jwise Exp $
3 .include <bsd.init.mk>
5 ##### Basic targets
6 includes: ${INCS} incinstall inclinkinstall
8 ##### Default values
9 INCSYMLINKS?=
11 ##### Install rules
12 incinstall:: # ensure existence
13 .PHONY: incinstall
15 # -c is forced on here, in order to preserve modtimes for "make depend"
16 __incinstall: .USE
17 @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
18 (${_MKSHMSG_INSTALL} ${.TARGET}; \
19 ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \
20 -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
21 ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \
22 -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
24 .for F in ${INCS:O:u}
25 _FDIR:= ${INCSDIR_${F:C,/,_,g}:U${INCSDIR}} # dir override
26 _FNAME:= ${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override
27 _F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
29 .if ${MKUPDATE} == "no"
30 ${_F}! ${F} __incinstall # install rule
31 .else
32 ${_F}: ${F} __incinstall # install rule
33 .endif
35 incinstall:: ${_F}
36 .PRECIOUS: ${_F} # keep if install fails
37 .endfor
39 .undef _FDIR
40 .undef _FNAME
41 .undef _F
43 inclinkinstall: .PHONY
44 .if !empty(INCSYMLINKS)
45 @(set ${INCSYMLINKS}; \
46 while test $$# -ge 2; do \
47 l=$$1; shift; \
48 t=${DESTDIR}$$1; shift; \
49 if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
50 [ "$$l" = "$$ttarg" ]; then \
51 continue ; \
52 fi ; \
53 ${_MKSHMSG_INSTALL} $$t; \
54 ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \
55 ${INSTALL_SYMLINK} $$l $$t; \
56 done; )
57 .endif