diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-09-17 01:18:35 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-09-17 01:18:35 +0000 |
commit | ed3bc6dd6a57440f298532a12f161265fd3ab545 (patch) | |
tree | 5ca47c8cf9fa8d4e01c40b55c81178bce3777d75 /Makefile | |
parent | 2c17a090196d4a5fc553be0fa219299303332455 (diff) |
This change (and a little change for alpha gcc config) allowed me to build
cross tools and kernels with those cross tools on all archs except mvme88k
and hppa.
1. Pass MACHINE_ARCH, not MACHINE to TARGET_MACHINE_ARCH when building old
binutils.
2. Instead of using the "intelligent" cpp voodoo to find out MACHINE_ARCH
from MACHINE (which has never worked correctly for sparc, 68k and
recently it broke for powerpc), we have a table of machine->machine_arch
translations. It's easier to modify one table once per arch instead of
juggling for a few hours every time some include files change.
3. Remove some sparc64 cruft.
4. Set MACHINE and MACHINE_ARCH in cross-env, otherwise the kernel will
try to build libkern for the host.
Please note that this doesn't allow you to do complete builds. I haven't
even tested cross-lib. Only kernel builds have been tested.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 54 |
1 files changed, 31 insertions, 23 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.78 2001/09/14 06:03:11 fgsch Exp $ +# $OpenBSD: Makefile,v 1.79 2001/09/17 01:18:34 art Exp $ # # For more information on building in tricky environments, please see @@ -114,21 +114,25 @@ CROSSENV= AR=${CROSSDIR}/usr/bin/ar AS=${CROSSDIR}/usr/bin/as \ HOSTCC=cc CROSSPATH= ${PATH}:${CROSSDIR}/usr/bin -.if (${TARGET} == "sparc64") -CROSSENV+= CPPFLAGS=-D__arch64__ -CPPFLAGS=-D__arch64__ -.endif - cross-env: - @echo ${CROSSENV} DESTDIR=${CROSSDIR} + @echo ${CROSSENV} DESTDIR=${CROSSDIR} MACHINE=${TARGET} MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` cross-helpers: @-mkdir -p ${CROSSDIR} - echo _MACHINE_ARCH | \ - cat ${.CURDIR}/sys/arch/${TARGET}/include/param.h - | \ - ${CPP} ${CPPFLAGS} -E -I${.CURDIR}/sys/arch | \ - sed -n '$$p' >${CROSSDIR}/TARGET_ARCH - eval `grep '^osr=' sys/conf/newvers.sh`; \ + @case ${TARGET} in \ + sparc|i386|m68k|alpha|hppa|powerpc|sparc64|m88k|vax) \ + echo ${TARGET} ;;\ + amiga|sun3|mac68k|hp300|mvme68k) \ + echo m68k ;;\ + mvme88k) \ + echo m88k ;;\ + mvmeppc|macppc) \ + echo powerpc ;;\ + *) \ + (echo Unknown arch ${TARGET} >&2) ; exit 1;; \ + esac > ${CROSSDIR}/TARGET_ARCH + @echo TARGET_ARCH is `cat ${CROSSDIR}/TARGET_ARCH` + @eval `grep '^osr=' sys/conf/newvers.sh`; \ sed "s/\$$/-unknown-openbsd$$osr/" ${CROSSDIR}/TARGET_ARCH > \ ${CROSSDIR}/TARGET_CANON @@ -161,7 +165,7 @@ cross-includes: cross-dirs ${MAKE} DESTDIR=${CROSSDIR} includes .if ${TARGET} == "macppc" || ${TARGET} == "alpha" || ${TARGET} == "hppa" || \ - ${TARGET} == "sparc64"|| ${TARGET} == "mvmeppc" + ${TARGET} == "sparc64"|| ${TARGET} == "mvmeppc" cross-binutils: cross-binutils-new cross-binutils-links .else cross-binutils: cross-binutils-old cross-binutils-links @@ -199,9 +203,9 @@ cross-gas: cross-dirs BSDOBJDIR=${CROSSDIR}/usr/obj \ BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} obj; \ - TARGET_MACHINE_ARCH=${TARGET} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ - ${MAKE} depend all; \ - TARGET_MACHINE_ARCH=${TARGET} \ + TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} depend all; \ + TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} NOMAN= install) ln -sf ${CROSSDIR}/usr/bin/as \ @@ -212,9 +216,9 @@ cross-ld: cross-dirs BSDOBJDIR=${CROSSDIR}/usr/obj \ BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} obj; \ - TARGET_MACHINE_ARCH=${TARGET} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ - ${MAKE} NOMAN= depend all; \ - TARGET_MACHINE_ARCH=${TARGET} \ + TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN= depend all; \ + TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} NOMAN= install) ln -sf ${CROSSDIR}/usr/bin/ld \ @@ -248,9 +252,11 @@ cross-strip: cross-dirs BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} obj; \ MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ - ${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN= depend all; \ + ${MAKE} TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + NOMAN= depend all; \ DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ - ${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN= install) + ${MAKE} TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + NOMAN= install) ln -sf ${CROSSDIR}/usr/bin/strip \ ${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/strip @@ -260,7 +266,8 @@ cross-size: cross-dirs BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} obj; \ MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ - ${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN= depend all; \ + ${MAKE} TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + NOMAN= depend all; \ DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} NOMAN= install) ln -sf ${CROSSDIR}/usr/bin/size \ @@ -272,7 +279,8 @@ cross-nm: cross-dirs BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} obj; \ MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ - ${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN= depend all; \ + ${MAKE} TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + NOMAN= depend all; \ DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ ${MAKE} NOMAN= install) ln -sf ${CROSSDIR}/usr/bin/nm \ |