Subject: Re: build.sh tries cross build with host CFLAGS/COPTS?
To: Hauke Fath <hf@tangro.de>
From: Andrew Brown <atatat@atatdot.net>
List: current-users
Date: 01/10/2003 11:55:14
>crt0.o cc1: Invalid option `cpu=supersparc'
>cc1: Invalid option `tune=supersparc'
>cc1: Invalid option `cpu=supersparc'
>cc1: Invalid option `tune=supersparc'
>*** Error code 1
>
>Stop.
>nbmake: stopped in /export/bsd/netbsd-src/current/src/lib/csu/m68k_elf
>*** Error code 1
>
>-- how do I teach a cross-build not to use CFLAGS and COPTS from
>/etc/mk.conf?

perhaps something like:

__HOST_MACHINE_ARCH!=uname -p
.if ${__HOST_MACHINE_ARCH} == ${MACHINE_ARCH}
CFLAGS=...
COPTS=...
.endif

that should make /etc/mk.conf not set things if the target isn't the
same as your host.  you can also conditionally set things in
/etc/mk.conf by checking:

	BSD_PKG_MK
	KERNEL_BUILD
	DESTDIR
	RELEASEDIR
	(etc.)

so that you can adjust certain settings for things like "kernel builds
as part of a release process" vs "a kernel build that i'm doing by
hand for this machine", etc.

you may wish to use MACHINE and uname -m instead of MACHINE_ARCH and
uname -p.  depends on how you wish to scope it.  for sparc, there is
only sparc, but if you were using, eg, a macppc host, you might want
the specificity.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."