Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Sep 2001 16:59:57 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        Eric Masson <e-masson@kisoft-services.com>, Larry Rosenman <ler@lerctr.org>, John Baldwin <jhb@FreeBSD.ORG>, freebsd-stable@FreeBSD.ORG, qa@FreeBSD.ORG
Subject:   Re: cputype=486
Message-ID:  <20010903165956.A2872@dhcp01.pn.xcllnt.net>
In-Reply-To: <20010903141538.A36786@xor.obsecurity.org>
References:  <20010901114903.D11062@athlon.pn.xcllnt.net> <XFMail.010901132212.jhb@FreeBSD.org> <20010901161054.B13047@athlon.pn.xcllnt.net> <20010902084832.B2510@lerami.lerctr.org> <20010902111131.B478@dhcp01.pn.xcllnt.net> <20010902163046.A26933@lerami.lerctr.org> <20010902144728.A41762@dhcp01.pn.xcllnt.net> <86elppyxhp.fsf@notbsdems.nantes.kisoft-services.com> <20010903094702.A554@dhcp01.pn.xcllnt.net> <20010903141538.A36786@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 03, 2001 at 02:15:38PM -0700, Kris Kennaway wrote:
> > 
> > I think it would be better to keep the definition of architecture
> > as it is but decorate it with model for build purposes. This means
> > that you need a simple way to extract the arch+model string from
> > the runtime environment so that you can use it in make(1). A build
> > is then started by saying something like:
> > 
> > 	make buildworld HOST_MACH=i386-p3
> 
> ${CPUTYPE} on the host system would do it.  Perhaps we need to make a
> new variable akin to the other cross-compiling variables to tell it
> what CPUTYPE to cross-compile for.

CPUTYPE can indeed be used for that, provided we stop using
MACHINE_ARCH for cross-build purposes. If we use HOST_MACH,
then make(1) can provide a default value based on MACHINE_ARCH
and CPUTYPE, otherwise the user has specified a cross-build
and MACHINE_ARCH and CPUTYPE are ignored.

If we handle the case where CPUTYPE is undefined, and also the
case where users define MACHINE_ARCH without the CPUTYPE portion,
it will look to most users as if we just changed the name of
the variable from MACHINE_ARCH to HOST_MACH, without breaking
backward compatibility.

We can probably also throw in a test that avoids constructing
HOST_MACH with a MACHINE_ARCH different from the native machine
but with the local CPUTYPE, to avoid mixing an i386 CPUTYPE with
a non-i386 MACHINE_ARCH.

The complete picture can be something like:

\begin{pseudo code}

# Construct BUILD_MACH - A description of the build machine.
# Avoid using MACHINE_ARCH for backward compatibility.
BUILD_MACH=`uname -m`
if (defined(CPUTYPE)) then
    BUILD_MACH=${BUILD_MACH}-${CPUTYPE}
fi

# Construct HOST_MACH - A description of the machine we're
# building for.
if (!defined(HOST_MACH)) then
    if (${MACHINE_ARCH} != `uname -m`) then
        HOST_MACH=${MACHINE_ARCH}
	# XXX - reset MACHINE_ARCH?
    else
        HOST_MACH=${BUILD_MACH}
    fi
fi

if (${BUILD_MACH} != ${HOST_MACH}) then
    echo "Cross-building!"
fi

\end{pseudo code}

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010903165956.A2872>