1# $NetBSD: bsd.inc.mk,v 1.31 2004/07/06 12:07:34 mycroft Exp $ 2 3.include <bsd.init.mk> 4 5##### Basic targets 6includes: ${INCS} incinstall inclinkinstall 7 8##### Default values 9INCSYMLINKS?= 10 11##### Install rules 12incinstall:: # ensure existence 13.PHONY: incinstall 14 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}) 23 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 28 29.if ${MKUPDATE} == "no" 30${_F}! ${F} __incinstall # install rule 31.else 32${_F}: ${F} __incinstall # install rule 33.endif 34 35incinstall:: ${_F} 36.PRECIOUS: ${_F} # keep if install fails 37.endfor 38 39.undef _FDIR 40.undef _FNAME 41.undef _F 42 43inclinkinstall: .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 58