From: deraadt Date: Thu, 10 Apr 1997 10:39:39 +0000 (+0000) Subject: if generating obj@ links, check if the existing obj@ link points to the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=32064f1b56824eec27442c2f3aad399ab86cfe0d;p=openbsd 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. --- diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index 1a65ba386e7..dc6e6cd9e2a 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.obj.mk,v 1.5 1996/08/23 22:42:41 niklas Exp $ +# $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) @@ -36,8 +36,12 @@ obj! _SUBDIRUSE if test $$here != $$subdir ; then \ dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \ echo "$$here/${__objdir} -> $$dest"; \ - rm -rf ${__objdir}; \ - ln -s $$dest ${__objdir}; \ + 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 \