Subject: Re: obj.${MACHINE_ARCH}-${OBJECT_FMT}
To: Ben Harris <bjh21@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-userlevel
Date: 10/18/2001 08:55:15
On Sat, Apr 28, 2001 at 04:19:47PM +0100, Ben Harris wrote:

 > object formats (e.g. the various m68k ports at the moment), so objdirs
 > should be named based on the (MACHINE_ARCH, OBJECT_FMT) tuple.

Actually, I'd like to go just a little further, here.

I just filed a PR yesterday indicating a problem with building
cross-toolchains in the USE_NEW_TOOLCHAIN case .. in particular,
consider:

	* Have native i386--netbsdelf toolchain built in src/tools (and
	  its objdirs).

	* Want to build i386 -> sparc64--netbsd toolchain in src/tools,
	  and leave the native toolchain intact.

You can't currently do this, which is extremely lame.  What if I have
a super-machine, that I want to cross-build for all my platforms (including
itself!) from?  Note, this is a GOAL of the new toolchain/build mechanism.

Part of the problem is that $MACHINE and $MACHINE_ARCH currently imply
both the host *and* the target.  I would like to see this changed.  In
particular, I would like to see something like this:

HOST_MACHINE= ${MACHINE}
HOST_MACHINE_ARCH= ${MACHINE_ARCH}

TARGET_MACHINE?= ${MACHINE}
TARGET_MACHINE_ARCH?= ${MACHINE_ARCH}
TARGET_MACHINE_CPU= what we do with MACHINE_CPU
TARGET_GNU_ARCH= what we do with MACHINE_GNU_ARCH
TARGET_GNU_PLATFORM= what we do with MACHINE_GNU_PLATFORM

...and for the HOST_ and TARGET_ versions of the variable used
explicitly throughout the build system.  Deprecate the use of
MACHINE_CPU, MACHINE_GNU_ARCH, and MACHINE_GNU_PLATFORM.

Then, you can do something clever like:

if $HOST_MACHINE_ARCH != $TARGET_MACHINE_ARCH
	objdirsuffix = \
	    ${HOST_MACHINE_ARCH}-${TARGET_MACHINE_ARCH}-${TARGET_OBJFMT}
fi

Or just assign it to the triple all the time and be done with it.

Anyway, this would then allow a builder to simply set TARGET_MACHINE
and TARGET_MACHINE_ARCH, and be able to cross-build the tree without
the weird side-effects of overriding MACHINE and MACHINE_ARCH.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>