Home | History | Annotate | Line # | Download | only in mk
bsd.kinc.mk revision 1.33
      1  1.33    lukem #	$NetBSD: bsd.kinc.mk,v 1.33 2003/11/07 00:05:24 lukem Exp $
      2   1.1      cgd 
      3   1.1      cgd # Variables:
      4   1.1      cgd #
      5   1.1      cgd # INCSDIR	Directory to install includes into (and/or make, and/or
      6   1.1      cgd #		symlink, depending on what's going on).
      7   1.1      cgd #
      8  1.25    lukem # INCS		Headers to install.
      9   1.1      cgd #
     10   1.4   castor # DEPINCS	Headers to install which are built dynamically.
     11   1.4   castor #
     12   1.1      cgd # SUBDIR	Subdirectories to enter
     13   1.1      cgd #
     14  1.29    lukem # INCSYMLINKS	Symlinks to make (unconditionally), a la bsd.links.mk.
     15   1.1      cgd #		Note that the original bits will be 'rm -rf'd rather than
     16   1.1      cgd #		just 'rm -f'd, to make the right thing happen with include
     17   1.1      cgd #		directories.
     18   1.1      cgd #
     19   1.1      cgd 
     20  1.19       tv .include <bsd.init.mk>
     21  1.19       tv 
     22  1.19       tv ##### Basic targets
     23  1.19       tv .PHONY:		incinstall
     24  1.32      chs .PHONY:		${DESTDIR}${INCSDIR}
     25  1.32      chs .PRECIOUS:	${DESTDIR}${INCSDIR}
     26  1.32      chs includes:	${DESTDIR}${INCSDIR} .WAIT ${INCS} incinstall
     27   1.1      cgd 
     28  1.19       tv ##### Install rules
     29  1.19       tv incinstall::	# ensure existence
     30   1.1      cgd 
     31   1.1      cgd # make sure the directory is OK, and install includes.
     32  1.15  mycroft 
     33   1.1      cgd ${DESTDIR}${INCSDIR}:
     34   1.7   kleink 	@if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \
     35  1.33    lukem 		${_MKSHMSG_CREATE} ${.TARGET}; \
     36   1.1      cgd 		/bin/rm -rf ${.TARGET}; \
     37  1.33    lukem 		${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \
     38  1.33    lukem 			${SYSPKGTAG} ${.TARGET}; \
     39  1.24    perry 		${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \
     40  1.24    perry 			${SYSPKGTAG} ${.TARGET}; \
     41   1.1      cgd 	fi
     42   1.1      cgd 
     43  1.19       tv # -c is forced on here, in order to preserve modtimes for "make depend"
     44  1.16  mycroft __incinstall: .USE
     45  1.16  mycroft 	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
     46  1.33    lukem 	    (${_MKSHMSG_INSTALL} ${.TARGET}; \
     47  1.31    lukem 	     ${_MKSHECHO} "${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
     48  1.24    perry 		-m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}" && \
     49  1.19       tv 	     ${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \
     50  1.24    perry 		-m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET})
     51  1.19       tv 
     52  1.19       tv .for F in ${INCS:O:u} ${DEPINCS:O:u}
     53  1.19       tv _F:=		${DESTDIR}${INCSDIR}/${F}		# installed path
     54  1.16  mycroft 
     55  1.26    lukem .if ${MKUPDATE} == "no"
     56  1.22  mycroft ${_F}!		${F} __incinstall			# install rule
     57  1.22  mycroft .else
     58  1.19       tv ${_F}:		${F} __incinstall			# install rule
     59  1.22  mycroft .endif
     60  1.22  mycroft 
     61  1.19       tv incinstall::	${_F}
     62  1.19       tv .PRECIOUS:	${_F}					# keep if install fails
     63   1.4   castor .endfor
     64   1.4   castor 
     65  1.19       tv .undef _F
     66   1.1      cgd 
     67  1.29    lukem .if defined(INCSYMLINKS) && !empty(INCSYMLINKS)
     68   1.1      cgd incinstall::
     69  1.29    lukem 	@(set ${INCSYMLINKS}; \
     70   1.1      cgd 	 while test $$# -ge 2; do \
     71  1.19       tv 		l=$$1; shift; \
     72  1.19       tv 		t=${DESTDIR}$$1; shift; \
     73  1.27    lukem 		if  ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
     74  1.27    lukem 		    [ "$$l" = "$$ttarg" ]; then \
     75  1.27    lukem 			continue ; \
     76  1.27    lukem 		fi ; \
     77  1.33    lukem 		${_MKSHMSG_INSTALL} $$t; \
     78  1.33    lukem 		${_MKSHECHO} ${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
     79  1.24    perry 		${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
     80  1.12   simonb 	 done; )
     81   1.1      cgd .endif
     82   1.1      cgd 
     83  1.19       tv ##### Pull in related .mk logic
     84   1.1      cgd .include <bsd.subdir.mk>
     85  1.28    lukem .include <bsd.sys.mk>
     86