bsd.inc.mk revision 1.25 1 # $NetBSD: bsd.inc.mk,v 1.25 2003/08/03 09:23:16 lukem Exp $
2
3 .include <bsd.init.mk>
4
5 ##### Basic targets
6 .PHONY: incinstall
7 includes: ${INCS} incinstall inclinkinstall
8
9 ##### Default values
10 INCSYMLINKS?=
11
12 ##### Install rules
13 incinstall:: # ensure existence
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 (echo "${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
19 -m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}" && \
20 ${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
21 -m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET})
22
23 .for F in ${INCS:O:u}
24 _FDIR:= ${INCSDIR_${F:C,/,_,g}:U${INCSDIR}} # dir override
25 _FNAME:= ${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override
26 _F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
27
28 .if ${MKUPDATE} == "no"
29 ${_F}! ${F} __incinstall # install rule
30 .else
31 ${_F}: ${F} __incinstall # install rule
32 .endif
33
34 incinstall:: ${_F}
35 .PRECIOUS: ${_F} # keep if install fails
36 .endfor
37
38 .undef _FDIR
39 .undef _FNAME
40 .undef _F
41
42 inclinkinstall::
43 .if !empty(INCSYMLINKS)
44 @(set ${INCSYMLINKS}; \
45 while test $$# -ge 2; do \
46 l=$$1; shift; \
47 t=${DESTDIR}$$1; shift; \
48 if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
49 [ "$$l" = "$$ttarg" ]; then \
50 continue ; \
51 fi ; \
52 echo "$$t -> $$l"; \
53 ${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
54 done; )
55 .endif
56