Subject: OBJDIRs that don't exist, in bsd.obj.mk
To: None <current-users@netbsd.org>
From: BOUWSMA Beery <netbsd-user@dcf77-zeit.netscum.dyndns.dk>
List: current-users
Date: 02/07/2002 13:42:35
Howdy again

I'm looking at the patches I've applied to -current to make it work
the way I want, and another of them comes about because I've defined
BSDOBJDIR to be something, sharing my /usr/obj with several object
trees.

The patch I applied is below.  As you can see, the comment claims
that a directory will be mkdir'ed, but that doesn't happen.  Oh sure,
I could create it by hand, but if I decide to free up some inodes by
nuking the whole object tree, then I'm back to square one, when the
build process could (should?) do it for me.

The second part of the patch concerns my BSDOBJDIR=/usr/obj/netbsd-current
line in /etc/mk.conf, which seems reasonable to me.  I mean, why not?
The first part is a by-product of experimenting to see what works to
specify an alternate to /usr/obj alone, and seems reasonable based
on the comment.  I mean, why not?  It's not quite identical to the
template immediately after the first patch, but...

Or am I overlooking something?  I seek advice.


thanks
barry bouwsma

--- /NetBSD/usr/src/share/mk/bsd.obj.mk	Thu Nov 29 12:57:21 2001
+++ /NetBSD/usr/local/source-hacks/share/mk/bsd.obj.mk	Mon Dec 31 17:56:42 2001
@@ -18,16 +18,19 @@
 # MAKEOBJDIR and MAKEOBJDIRPREFIX are env variables supported
 # by make(1).  We simply mkdir -p the specified path.
 # If that fails - we do a mkdir to get the appropriate error message
 # before bailing out.
 obj:
 .if defined(MAKEOBJDIRPREFIX)
 	@if [ ! -d ${MAKEOBJDIRPREFIX} ]; then \
-		echo "MAKEOBJDIRPREFIX ${MAKEOBJDIRPREFIX} does not exist, bailing..."; \
-		exit 1; \
+		mkdir -p ${MAKEOBJDIRPREFIX}; \
+		if [ ! -d ${MAKEOBJDIRPREFIX} ]; then \
+			echo "MAKEOBJDIRPREFIX ${MAKEOBJDIRPREFIX} does not exist, bailing..."; \
+			exit 1; \
+		fi; \
 	fi; 
 .endif
 	@if [ ! -d ${__objdir} ]; then \
 		mkdir -p ${__objdir}; \
 		if [ ! -d ${__objdir} ]; then \
 			mkdir ${__objdir}; exit 1; \
 		fi; \
@@ -54,16 +57,19 @@
 .endif
 
 obj:
 	@cd ${__curdir}; \
 	here=`${PAWD}`/; subdir=$${here#${BSDSRCDIR}/}; \
 	if [ "$$here" != "$$subdir" ]; then \
 		if [ ! -d ${__usrobjdir} ]; then \
-			echo "BSDOBJDIR ${__usrobjdir} does not exist, bailing..."; \
-			exit 1; \
+			mkdir -p ${__usrobjdir}; \
+			if [ ! -d ${__usrobjdir} ]; then \
+				echo "BSDOBJDIR ${__usrobjdir} does not exist, bailing..."; \
+				exit 1; \
+			fi; \
 		fi; \
 		subdir=$${subdir%/}; \
 		dest=${__usrobjdir}/$$subdir${__usrobjdirpf}; \
 		if [ -h $${here}${__objdir} ]; then \
 			curtarg=`ls -ld $${here}${__objdir} | awk '{print $$NF}'` ; \
 			if [ "$$curtarg" = "$$dest" ]; then \
 				: ; \