Return to bsd.obj.mk CVS log | Up to [local] / src / share / mk |
File: [local] / src / share / mk / bsd.obj.mk (download)
Revision 1.6, Thu Apr 10 10:39:39 1997 UTC (27 years, 2 months ago) by deraadt
if generating obj@ links, check if the existing obj@ link points to the same path we want to make it point to later. If it does, leave the link as-is and do not attempt to recreate it. read-only /usr/src with obj@ links will work much better with this. Fix from Niklas -- anyone who figures out a way to do this without using perl gets a cookie. |
# $OpenBSD: bsd.obj.mk,v 1.6 1997/04/10 10:39:39 deraadt Exp $ # $NetBSD: bsd.obj.mk,v 1.9 1996/04/10 21:08:05 thorpej Exp $ .if !target(obj) .if defined(NOOBJ) obj: .else .if defined(MAKEOBJDIR) __baseobjdir= ${MAKEOBJDIR} .else __baseobjdir= obj .endif .if defined(OBJMACHINE) __objdir= ${__baseobjdir}.${MACHINE} .else __objdir= ${__baseobjdir} .endif .if defined(USR_OBJMACHINE) __usrobjdir= ${BSDOBJDIR}.${MACHINE} __usrobjdirpf= .else __usrobjdir= ${BSDOBJDIR} .if defined(OBJMACHINE) __usrobjdirpf= .${MACHINE} .else __usrobjdirpf= .endif .endif obj! _SUBDIRUSE @cd ${.CURDIR}; rm -f ${__objdir} > /dev/null 2>&1 || true; \ here=`/bin/pwd`; subdir=$${here#${BSDSRCDIR}/}; \ if test $$here != $$subdir ; then \ dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \ echo "$$here/${__objdir} -> $$dest"; \ if test ! -L ${__objdir} -o \ X`perl -e "print readlink('${__objdir}')"` != X$$dest; \ then \ test -e ${__objdir} && rm -rf ${__objdir}; \ ln -s $$dest ${__objdir}; \ fi; \ if test -d ${__usrobjdir} -a ! -d $$dest; then \ mkdir -p $$dest; \ else \ true; \ fi; \ else \ true ; \ dest=$$here/${__objdir} ; \ if test ! -d ${__objdir} ; then \ echo "making $$dest" ; \ mkdir $$dest; \ fi ; \ fi; .endif .endif