Subject: re: road map for new immigrants?
To: Bill Studenmund <>
From: matthew green <>
List: current-users
Date: 09/15/1998 19:01:32
   My suggestion is to set things up for obj work BEFORE compiling. I didn't,
   and I still have little bits of crud lying around.
   Important make variables (which I set in /etc/mk.conf):
   BSDSRCDIR	This is where the source lives. For me, it's on my
   			/y2 partition.
   BSDOBJDIR	Here's where all the obj stuff will go. For me, it's
   			on the /y5 partition.
   OBJMACHINE=1	Use the machine name when making obj dirs, so you
   			get obj.i386, obj.mac68k, ...
   There are two ways the obj.XXX stuff works. If you're compiling from under
   the BSDSRCDIR tree (and leaving it /usr/src when /usr/src is a sym link
   doesn't count), you get a slew of symlinks to directories under the
   BSDOBJDIR tree. For instance, BSDSRCDIR/bin/sh has obj.i386, obj.mac68k,
   and obj.macppc, which are symlinks to the BSDOBJDIR/bin/sh.i386,
   sh.mac68k, and sh.macppc directories.
   If you're not under the BSDSRCDIR hierarchy, you get directories in your
   source tree.

while we're giving lessons, let me expand on this one..

BSDSRCDIR: the *realpath* of the src directory, typically /usr/src.  it
*can* *not* be a symlink if you want BSDOBJDIR to work correctly.

BSDOBJDIR: directory where objects for sources in BSDSRCDIR go.  it can
be a symlink and this makes it quite powerful [see below].

OBJMACHINE: defines whether to create obj.${MACHINE} or just obj, in the
source directory.

USR_OBJMACHINE: defines whether $BSDOBJDIR gets a .${MACHINE} postfix or
not, rather than individual directories getting prog.${MACHINE}.

here's the relevant bits from my /etc/mk.conf (and is the same all my
sparc, arm32, pmax and hp300 machines):

	BSDSRCDIR?=		/orb/v/src
	BSDOBJDIR?=		/var/obj

where my sources *really* live in /orb/v/src, and i want .${MACHINE}
postfixes on my objdirs.  what this does is this (my example will be

in /orb/v/src/bin/ps:

lrwxrwxr-x  1 root  wsrc      21 Aug  9 15:26 obj.arm32 -> /var/obj.arm32/bin/ps
lrwxrwxr-x  1 root  wsrc      21 Aug 13 11:44 obj.hp300 -> /var/obj.hp300/bin/ps
lrwxrwxr-x  1 root  wsrc      20 Mar 24 11:10 obj.pmax -> /var/obj.pmax/bin/ps
lrwxrwxr-x  1 root  wsrc      21 Sep  2 01:42 obj.sparc -> /var/obj.sparc/bin/ps

/var/obj.${MACHINE} is a symlink to the correct object directory for
that machine (and thus makes it *very* easy to switch objdirs for
the same ${MACHINE} by switching /var/obj.${MACHINE} to some new
place).  eg, on one sparc i have:

lrwxr-xr-x  1 root  wheel  16 Jun 26 14:16 /var/obj.sparc -> /orb/a/obj.sparc

and another has:

lrwxrwxr-x  1 root  wheel  16 Mar  1  1998 /var/obj.sparc -> /orb/g/obj.sparc

where /orb/a and /orb/g are local disks for each machine, so that they
can build from separate objtrees.  when i want to update one machine
from another's objects, i just switch the /var/obj.sparc link to the
right place, and `make install'.

hope this helps, it wasn't going to be this long :)