Subject: obj.${MACHINE_ARCH} etc
To: None <>
From: Ben Harris <>
List: tech-userlevel
Date: 04/18/2001 13:38:44
One of the arguments against splitting up the arm32 port into lots of
little ports has been that it will make building binary snapshots slower,
since the current build system treats each MACHINE separately, putting
binaries in obj.${MACHINE}.  This means that it's not possible to take
advantage of all the work done in building (say) a dnard snapshot when
building an hpcarm snapshot in the same tree.  This is clearly silly.

Clearly (to me), what's needed is for builds of the same MACHINE_ARCH to
be able to share objdirs.  Clearly, also, this won't always be
appropriate.  Here's a way to achieve that:

We arrange that create obj.${OBJDIRSUFFIX} rather than
obj.${MACHINE} if OBJDIRSUFFIX is defined.  It also symlinks
obj.${MACHINE} to obj.{$OBJDIRSUFFIX} so as to avoid the need to modify
make.  Any Makefile that knows that it's not doing anything
MACHINE-specific can define OBJDIRSUFFIX=${MACHINE_ARCH} and get to share
objdirs with builds for other systems.

A rough diff to which seems to accomplish this is below.  Is
this the right way to be going about this?

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/18 12:26:11
@@ -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:>