Subject: Re: Cross-build question.
To: Simon J. Gerraty <sjg@crufty.net>
From: Frederick Bruckman <fredb@immanent.net>
List: current-users
Date: 02/04/2003 18:19:40
On Tue, 4 Feb 2003, Simon J. Gerraty wrote:

> >The problem I see here is that I cannot in any way, shape or form,
> >find which *CFLAGS variable I can use such that host-built host tools
> >can be passed any of the requisite args for the host, simultaneously
> >being able to pass something suitable for crossbuilding to the target
> >build tools.  I.e. specifically, I wish to enable "-O3 -mv8
> >-mcpu=supersparc" to the target compiler running on the host.
>
> I put:
>
> .if ${MACHINE_ARCH} == "sparc"
> DEFCOPTS=-O2 -msupersparc
> .endif
>
> in /etc/mk.conf and it does the right thing - for kernel builds
> at least.  The same trick should work for other bits of the build.

${DEFCOPTS} doesn't work for other parts of the build, only ${COPTS}.
I have something like this in "/etc/mk.conf":

    HOST_CFLAGS?=          -O2 -march=k6

    .if     ${MACHINE} == "i386"
    COPTS?=                -O2 -mcpu=k6
    .elif   ${MACHINE} == "mac68k"
    COPTS?=                -O2 -m68020-40
    .endif

So, the tools get built with "-O2 -march=k6", the i386 release gets
built with "-O2 -mcpu=k6", and so on. Note the question mark '?'!
Without that, you're likely to break the INSTALL* kernels.

Frederick