From owner-cvs-all Tue Nov 16 9:15: 5 1999 Delivered-To: cvs-all@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 2156914D9E; Tue, 16 Nov 1999 09:14:53 -0800 (PST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id KAA03210; Tue, 16 Nov 1999 10:14:40 -0700 (MST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id KAA09479; Tue, 16 Nov 1999 10:14:42 -0700 (MST) Message-Id: <199911161714.KAA09479@harmony.village.org> To: Marcel Moolenaar Subject: Re: cvs commit: src Makefile.inc1 src/usr.bin/make Makefile Cc: cvs-committers@freebsd.org, cvs-all@freebsd.org In-reply-to: Your message of "Tue, 16 Nov 1999 17:44:39 +0100." <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> Date: Tue, 16 Nov 1999 10:14:42 -0700 From: Warner Losh Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk 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