Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 1999 10:14:42 -0700
From:      Warner Losh <imp@village.org>
To:        Marcel Moolenaar <marcel@scc.nl>
Cc:        cvs-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src Makefile.inc1 src/usr.bin/make Makefile 
Message-ID:  <199911161714.KAA09479@harmony.village.org>
In-Reply-To: Your message of "Tue, 16 Nov 1999 17:44:39 %2B0100." <383189F7.67E89E8B@scc.nl> 
References:  <383189F7.67E89E8B@scc.nl>  <38310A94.B1939A83@scc.nl> <199911151707.JAA03820@freefall.freebsd.org> <199911160533.WAA02391@harmony.village.org> <199911161544.IAA08642@harmony.village.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <383189F7.67E89E8B@scc.nl> Marcel Moolenaar writes:
: When MACHINE_ARCH is used to denote the target machine instead of the
: host machine (which it represents by definition), then you only have to
: set MACHINE_ARCH in the environment (although the commandline works as
: well). Make uses the environment variables if they are present. Make is
: not a cross-tool.

OK.  I know when I was doing this I had to do a lot of gross things
because make got in the way and insisted on trying to define
MACHINE_ARCH even if it was defined in the environment.  This may have
changed (I may have changed it).  There are also makefiles in the
kernel that use MACHINE, so both MACHINE and MACHINE_ARCH need to be
defined in order for them to work correctly.

: I want to use TARGET_ARCH for building the cross-compiler:
: 
: [Assume we're running on an i386]
: 
: MACHINE_ARCH = i386, TARGET_ARCH = i386
: 	Regular build and no cross-compiler.
: MACHINE_ARCH = i386, TARGET_ARCH = mips
: 	Make a cross-compiler to cross-build for MIPS (used for
: 	building cross-tools on i386).
: MACHINE_ARCH = mips, TARGET_ARCH = mips
: 	Cross-build for MIPS and don't build a cross-compiler
: 	(used to make the native MIPS compiler).
: MACHINE_ARCH = mips, TARGET_ARCH = alpha
: 	Cross-build for MIPS and make a cross-compiler for Alpha
: 	(to run on MIPS) (It's free :-)
: 
: Currently MACHINE_ARCH is tested against `sysctl -n hw.machine_arch` and
: if they differ then we're building a cross-compiler. This obviously
: doesn't work if we are making the native MIPS compiler in a
: cross-build...

Yes.  I put the TARGET and TARGET_ARCH in so that you know during the
early part of the build process that you are on the host machine, but
can switch that for later in the build process.  You need to know what
machine you are on early in the build process so you can build a
compiler that runs on that machine, build a make, etc.  When cross
compiling you can't use the host's libraries.  However, there is a
twist in this.  Some programs, like fortune, builds programs that need
to run in the host environment to create the programs that run in the
target environment.

I don't think the above is going to work.  gcc, and friends, have
three levels here.  host, target, and build.  If you want to support
three levels, maybe you need to go this route (eg if I'm building
linux mips binaries to produce dec alpha osf1 code on my i386 freebsd
box, host is i386-freebsd, target is dec-alpha-osf and build is
linux-mips).  With only two variables, you are going to only have host
and target.

If none of the programs build programs to build them, then this whole
mess would be easier...

Warner



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911161714.KAA09479>