From owner-cvs-all Tue Nov 16 8:45:14 1999 Delivered-To: cvs-all@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id 458C714D98; Tue, 16 Nov 1999 08:44:51 -0800 (PST) (envelope-from marcel@scc.nl) Received: from [212.238.132.94] (helo=scones.sup.scc.nl) by post.mail.nl.demon.net with esmtp (Exim 2.12 #1) id 11nlj8-000M5k-00; Tue, 16 Nov 1999 16:45:06 +0000 Received: from scc.nl (scones.sup.scc.nl [192.168.2.4]) by scones.sup.scc.nl (8.9.3/8.9.3) with ESMTP id RAA52404; Tue, 16 Nov 1999 17:44:39 +0100 (CET) (envelope-from marcel@scc.nl) Message-ID: <383189F7.67E89E8B@scc.nl> Date: Tue, 16 Nov 1999 17:44:39 +0100 From: Marcel Moolenaar Organization: SCC vof X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.5 i386) X-Accept-Language: en MIME-Version: 1.0 To: Warner Losh Cc: cvs-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src Makefile.inc1 src/usr.bin/make Makefile References: <38310A94.B1939A83@scc.nl> <199911151707.JAA03820@freefall.freebsd.org> <199911160533.WAA02391@harmony.village.org> <199911161544.IAA08642@harmony.village.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk Warner Losh wrote: > > In message <38310A94.B1939A83@scc.nl> Marcel Moolenaar writes: > : If make is compiled against the right set of headers, you are never > : going to need this. The Makefiles are full of those `cross-compilation' > : hacks that are basicly only needed because cross-building is broken by > : design. The only way to fix cross-building is to get to the bones of > : things and CROSS_MAKE_FLAGS is currently in the way. > > But without them, make won't define MACHINE and MACHINE_ARCH > correctly, which is critical to have any sort of cross building work. 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. > I was unable to get cross compiling working at all by defining MACHINE > and MACHINE_ARCH on the command line, but I think that is due to make > trying to second guess things (maybe this code has been slain inside > of make). That's why it was needed. What are you replacing it with? > What's your cross building direction? My first approach was to leave MACHINE{_ARCH} alone and use TARGET{_ARCH} for that. The problem is that you need to modify a lot of makefiles. I abandoned it. I now want the main makefile (ie /usr/src/Makefile) to add MACHINE and MACHINE_ARCH to the environment used by the sub-makes (although it's not actually needed): Assume the following makefile: default: second make second second: @echo machine=${MACHINE} @echo machine_arch=${MACHINE_ARCH} % make machine=i386 machine_arch=i386 make second machine=i386 machine_arch=i386 % make MACHINE_ARCH=alpha machine=i386 machine_arch=alpha make second machine=i386 machine_arch=alpha 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... -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ The FreeBSD project mailto:marcel@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message