Subject: obj.${MACHINE_ARCH}-${OBJECT_FMT}
To: None <>
From: Ben Harris <>
List: tech-userlevel
Date: 04/28/2001 16:19:47
As far as I can tell, the two problems people spotted with my last
suggestion about MACHINE_ARCH-specific objdirs[1] were that the default
should be to share objdirs within a MACHINE_ARCH, and that there would be
problems on sparc64, because of the particularly flexible way MACHINE_ARCH
is used there.  Another problem that occurred to me is that within a
MACHINE_ARCH, we might sometimes have different MACHINEs using different
object formats (e.g. the various m68k ports at the moment), so objdirs
should be named based on the (MACHINE_ARCH, OBJECT_FMT) tuple.

[1] <URL:>

With that in mind, here's my current patch to  In the default
case, it creates obj.${MACHINE_ARCH}-${OBJECT_FMT}, and symlinks it from
obj.${MACHINE}.  sparc64 systems can flip between using obj.sparc-ELF and
obj.sparc64-ELF by changing MACHINE_ARCH and re-running "make obj", which
I suspect is a simple as it's going to get.  The only problem I can see
with this is that in the USR_OBJMACHINE case, you end up with
/usr/obj.i386 and /usr/obj.i386-ELF, which seems a bit odd, but I think is
a necessary consequence of coping with sparc64.

RCS file: /cvsroot/sharesrc/share/mk/,v
retrieving revision 1.26
diff -u -u -r1.26
---	2001/03/11 07:32:31	1.26
+++	2001/04/28 15:04:25
@@ -5,6 +5,8 @@
 .include <>

 .if ${MKOBJ} == "no"
@@ -28,18 +30,18 @@
 .if defined(OBJMACHINE)
-__objdir=	obj.${MACHINE}
+__objdir=	obj.${OBJDIRSUFFIX}
 __objdir=	obj

 .if defined(USR_OBJMACHINE)
-__usrobjdir=	${BSDOBJDIR}.${MACHINE}
+__usrobjdir=	${BSDOBJDIR}.${OBJDIRSUFFIX}
 __usrobjdir=	${BSDOBJDIR}
 .if defined(OBJMACHINE)
-__usrobjdirpf=	.${MACHINE}
+__usrobjdirpf=	.${OBJDIRSUFFIX}
@@ -80,6 +82,11 @@
 			mkdir $$dest; \
 		fi ; \
+	@echo "obj.${MACHINE} -> ${__objdir}"
+	@rm -f obj.${MACHINE}
+	@ln -s ${__objdir} obj.${MACHINE}

Ben Harris                                                   <>
Portmaster, NetBSD/arm26               <URL:>