Subject: per-machine OBJDIR with, but not for tools?
To: None <>
From: Greg Troxel <>
List: current-users
Date: 02/13/2004 13:10:50
[sorry if this belongs on tech-toolchain; I wasn't sure]

I have a 1.6.2/i386 system and am building -current for i386, sparc
and sparc64.  I can't make objdirs do what I want, and from reading I think I understand part of why.

What I want:

  my source tree is not in /usr/src

  no writes to the source tree

  tools in /usr/obj/tools.current
  tools obj tree someplace under /usr/obj/current, with a single obj
  dir for host tools, and some appropriate (non-redundant but
  different when it needs to be) dir for cross-compilers


  target obj trees someplace under /usr/obj/current
  with per-target obj dirs, so I can keep multiple around

What I'm settling for:

  export OBJMACHINE=t
  ./ -m $arch -T /usr/obj/tools.current -u distribution

This uses obj.{i386,sparc,sparc64} under each source dir, which breaks
'no writes to source tree' but is otherwise winning.

I end up with destdir/releasedir in my source tree, but that's not as
annoying as obj turds, and I could move them with -D/-R if that were
my only problem.

I have 3 copies of obj for host-only tools, and the contents of the
.o/binaries are byte-for-byte identical:

> ls -l tools/cat/obj.*
total 22
-rw-r--r--  1 root  users   1974 Feb 12 20:28 .depend
-rwxr-xr-x  1 root  users  10620 Feb 12 20:28 cat
-rw-r--r--  1 root  users   1974 Feb 12 20:28 cat.d
-rw-r--r--  1 root  users   6180 Feb 12 20:28 cat.lo

total 22
-rw-r--r--  1 root  users   1975 Feb 12 23:08 .depend
-rwxr-xr-x  1 root  users  10620 Feb 12 23:08 cat
-rw-r--r--  1 root  users   1975 Feb 12 23:08 cat.d
-rw-r--r--  1 root  users   6180 Feb 12 23:08 cat.lo

total 22
-rw-r--r--  1 root  users   1977 Feb 13 01:29 .depend
-rwxr-xr-x  1 root  users  10620 Feb 13 01:29 cat
-rw-r--r--  1 root  users   1977 Feb 13 01:29 cat.d
-rw-r--r--  1 root  users   6180 Feb 13 01:29 cat.lo

.depend and cat.d differ in pointing to different values of
src/tools/compat/obj.$arch, but diffing those dirs gets me only
different tmpfile names in configure tests and different mod dates in

My problems, then, boil down to two things

A) does not support OBJMACHINE at the same time as
source dir or the /usr/src:/usr/obj mapping.

B) There should be some way to have OBJMACHINE set for cross-builds
but not set when building tools.  Perhaps there is, but if so I've
missed it.

I tried to patch to solve A, but I didn't succeed.  Is this
the right approach for (A).  I can certainly live with (B) not being
solved - tools obj is not that huge.

Finally, I am baffled about the use of -M vs -O with  It
seems that '-O /usr/obj/current' does what I want, except for
per-machine objdirs.  -M doesn't seem to put destdir/releasedir under
the given dir, but -O does.  I think that the -O magic:
is supposed to put obj under the given path, with the real src path
stripped to top-level, so with -O /usr/obj/current I'd have stuff in
/usr/obj/current/bin, and that does seem to happen.

So perhaps needs an option to have per-arch objdirs, and
should set the variables differently for tools (no per-arch dir) and
the actual build.

Am I on the right track here?

        Greg Troxel <>