Subject: Re: CVS commit: basesrc
To: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 12/04/1999 14:24:03
Bill Sommerfeld wrote:

> > > It removes and re-creates the symlink (if you're using symlinks) for
> > > each obj directory.  This is noticebly slow especially when using a NFS
> > > v2 fileserver for the source tree.  
> 
> I just fixed this.

Using "test $$dest -ef ${__objdir}" would be bit more efficient.  The
following seems to work for a few test cases:

Index: bsd.obj.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.obj.mk,v
retrieving revision 1.22
diff -p -u -r1.22 bsd.obj.mk
--- bsd.obj.mk	1999/12/04 02:44:07	1.22
+++ bsd.obj.mk	1999/12/04 03:23:40
@@ -36,24 +36,18 @@ obj:
 	here=`${PAWD}`; subdir=$${here#${BSDSRCDIR}/}; \
 	if test $$here != $$subdir ; then \
 		dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \
-		if [ -L $$here/${__objdir} ]; then \
-			curtarg=`ls -ld $$here/${__objdir} | awk '{print $$NF}'` ; \
-			if [ "$$curtarg" = "$$dest" ]; then \
-				: ; \
-			else \
-				echo "$$here/${__objdir} -> $$dest"; \
-				rm -rf ${__objdir}; \
-				ln -s $$dest ${__objdir}; \
-			fi; \
-		else \
-			echo "$$here/${__objdir} -> $$dest"; \
-			rm -rf ${__objdir}; \
-			ln -s $$dest ${__objdir}; \
-		fi; \
 		if test -d ${__usrobjdir} -a ! -d $$dest; then \
+			echo mkdir -p $$dest; \
 			mkdir -p $$dest; \
 		else \
 			true; \
+		fi; \
+		if [ $$dest -ef ${__objdir} ]; then \
+			: ; \
+		else \
+			echo "$$here/${__objdir} -> $$dest"; \
+			rm -rf ${__objdir}; \
+			ln -s $$dest ${__objdir}; \
 		fi; \
 	else \
 		true ; \

This also adds a echo of the mkdir - is this a good or a bad thing?

Simon.