Home | History | Annotate | Line # | Download | only in mk
bsd.inc.mk revision 1.28
      1 #	$NetBSD: bsd.inc.mk,v 1.28 2003/11/07 00:05:24 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 	    (${_MKSHMSG_INSTALL} ${.TARGET}; \
     19 	     ${_MKSHECHO} "${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
     20 		-m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}" && \
     21 	     ${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
     22 		-m ${NONBINMODE} ${SYSPKGTAG} ${.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 
     35 incinstall::	${_F}
     36 .PRECIOUS:	${_F}					# keep if install fails
     37 .endfor
     38 
     39 .undef _FDIR
     40 .undef _FNAME
     41 .undef _F
     42 
     43 inclinkinstall::
     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} ${SYSPKGTAG} $$l $$t; \
     55 		${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
     56 	 done; )
     57 .endif
     58