Subject: Re: build.sh tries cross build with host CFLAGS/COPTS?
To: Pavel Cahyna <pcah8322@artax.karlin.mff.cuni.cz>
From: Andrew Brown <atatat@atatdot.net>
List: current-users
Date: 01/14/2003 12:40:03
>> 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
>
>That's nice, but things are unfortunately more complicated. For tools
>(build.sh -t), at least for the GNU toolchain, CFLAGS are ignored and
>youn need to set HOST_CFLAGS to have the tools optimized for your
>platform. This is probably a feature of GNU configure. E. g. if I 
>compiled for an i386 on an alpha, I've set 
>HOST_CFLAGS=-O2 -mcpu=ev4

i think that's an orthogonal issue.  the original problem as i
understood it was not that flags didn't get passed to the host tools
properly, but that flags got improperly passed to the cross-tools when
they should not have.  by checking that the host and the target are
the "same", you can avoid the latter.

>And, when bulding cross-compilation tools, is MACHINE_ARCH defined to the 
>arch of your host or to the arch for which you are compiling? I think
>the first would make more sense, but I haven't checked it.

ifaict, if you're building cross tools via build.sh (ie, you are
running "./build.sh -t -m foo"), then build.sh will set MACHINE and
MACHINE_ARCH to the *target*.

-- 
|-----< "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."