1 1.26 lukem # $NetBSD: bsd.kinc.mk,v 1.26 2003/07/18 08:26:07 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.1 cgd # SYMLINKS 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.19 tv includes: ${INCS} incinstall 25 1.1 cgd 26 1.19 tv ##### Install rules 27 1.19 tv incinstall:: # ensure existence 28 1.1 cgd 29 1.1 cgd # make sure the directory is OK, and install includes. 30 1.19 tv incinstall:: ${DESTDIR}${INCSDIR} 31 1.19 tv .PRECIOUS: ${DESTDIR}${INCSDIR} 32 1.19 tv .PHONY: ${DESTDIR}${INCSDIR} 33 1.15 mycroft 34 1.1 cgd ${DESTDIR}${INCSDIR}: 35 1.7 kleink @if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \ 36 1.1 cgd echo creating ${.TARGET}; \ 37 1.1 cgd /bin/rm -rf ${.TARGET}; \ 38 1.24 perry ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ 39 1.24 perry ${SYSPKGTAG} ${.TARGET}; \ 40 1.1 cgd fi 41 1.1 cgd 42 1.19 tv # -c is forced on here, in order to preserve modtimes for "make depend" 43 1.16 mycroft __incinstall: .USE 44 1.16 mycroft @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ 45 1.19 tv (echo "${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \ 46 1.24 perry -m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}" && \ 47 1.19 tv ${INSTALL_FILE:N-c} -c -o ${BINOWN} -g ${BINGRP} \ 48 1.24 perry -m ${NONBINMODE} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}) 49 1.19 tv 50 1.19 tv .for F in ${INCS:O:u} ${DEPINCS:O:u} 51 1.19 tv _F:= ${DESTDIR}${INCSDIR}/${F} # installed path 52 1.16 mycroft 53 1.26 lukem .if ${MKUPDATE} == "no" 54 1.22 mycroft ${_F}! ${F} __incinstall # install rule 55 1.22 mycroft .else 56 1.19 tv ${_F}: ${F} __incinstall # install rule 57 1.22 mycroft .endif 58 1.22 mycroft 59 1.19 tv incinstall:: ${_F} 60 1.19 tv .PRECIOUS: ${_F} # keep if install fails 61 1.4 castor .endfor 62 1.4 castor 63 1.19 tv .undef _F 64 1.1 cgd 65 1.1 cgd .if defined(SYMLINKS) && !empty(SYMLINKS) 66 1.1 cgd incinstall:: 67 1.10 drochner @(set ${SYMLINKS}; \ 68 1.1 cgd while test $$# -ge 2; do \ 69 1.19 tv l=$$1; shift; \ 70 1.19 tv t=${DESTDIR}$$1; shift; \ 71 1.17 cgd if [ -h $$t ]; then \ 72 1.12 simonb cur=`ls -ld $$t | awk '{print $$NF}'` ; \ 73 1.12 simonb if [ "$$cur" = "$$l" ]; then \ 74 1.12 simonb continue ; \ 75 1.12 simonb fi; \ 76 1.12 simonb fi; \ 77 1.12 simonb echo "$$t -> $$l"; \ 78 1.24 perry ${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \ 79 1.12 simonb done; ) 80 1.1 cgd .endif 81 1.1 cgd 82 1.19 tv ##### Pull in related .mk logic 83 1.1 cgd .include <bsd.subdir.mk> 84