1 1.34 christos # $NetBSD: bsd.inc.mk,v 1.34 2022/03/29 22:48:04 christos Exp $ 2 1.24 lukem 3 1.24 lukem .include <bsd.init.mk> 4 1.3 mycroft 5 1.20 tv ##### Basic targets 6 1.25 lukem includes: ${INCS} incinstall inclinkinstall 7 1.25 lukem 8 1.25 lukem ##### Default values 9 1.25 lukem INCSYMLINKS?= 10 1.1 christos 11 1.20 tv ##### Install rules 12 1.20 tv incinstall:: # ensure existence 13 1.30 lukem .PHONY: incinstall 14 1.14 mycroft 15 1.16 mycroft __incinstall: .USE 16 1.1 christos @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ 17 1.28 lukem (${_MKSHMSG_INSTALL} ${.TARGET}; \ 18 1.33 christos ${_MKSHECHO} "${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \ 19 1.32 jwise -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ 20 1.33 christos ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \ 21 1.32 jwise -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) 22 1.16 mycroft 23 1.20 tv .for F in ${INCS:O:u} 24 1.20 tv _FDIR:= ${INCSDIR_${F:C,/,_,g}:U${INCSDIR}} # dir override 25 1.20 tv _FNAME:= ${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override 26 1.20 tv _F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path 27 1.20 tv 28 1.24 lukem .if ${MKUPDATE} == "no" 29 1.22 mycroft ${_F}! ${F} __incinstall # install rule 30 1.22 mycroft .else 31 1.20 tv ${_F}: ${F} __incinstall # install rule 32 1.22 mycroft .endif 33 1.22 mycroft 34 1.20 tv incinstall:: ${_F} 35 1.20 tv .PRECIOUS: ${_F} # keep if install fails 36 1.1 christos .endfor 37 1.5 mycroft 38 1.20 tv .undef _FDIR 39 1.20 tv .undef _FNAME 40 1.20 tv .undef _F 41 1.25 lukem 42 1.31 mycroft inclinkinstall: .PHONY 43 1.25 lukem .if !empty(INCSYMLINKS) 44 1.25 lukem @(set ${INCSYMLINKS}; \ 45 1.25 lukem while test $$# -ge 2; do \ 46 1.25 lukem l=$$1; shift; \ 47 1.25 lukem t=${DESTDIR}$$1; shift; \ 48 1.34 christos if ttarg=$$(${TOOL_STAT} -qf '%Y' $$t) && \ 49 1.25 lukem [ "$$l" = "$$ttarg" ]; then \ 50 1.25 lukem continue ; \ 51 1.25 lukem fi ; \ 52 1.28 lukem ${_MKSHMSG_INSTALL} $$t; \ 53 1.32 jwise ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ 54 1.32 jwise ${INSTALL_SYMLINK} $$l $$t; \ 55 1.25 lukem done; ) 56 1.25 lukem .endif 57