diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-10-21 20:47:30 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-10-21 20:47:30 +0000 |
commit | b6022135dfdcbee7f0697274a23e7ab05b76ddaf (patch) | |
tree | 0317949cd990605f93a9c7f4919333f99f60c6a0 | |
parent | e15b1a7cb858f642962f753d8212f742b9a1ed11 (diff) |
Move the cross glue from the root makefile to the toolchain's,
allowing bulding cross-tools with new binutils and gcc3.
ok drahn@ brad@ espie@
-rw-r--r-- | Makefile | 46 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/Makefile.bsd-wrapper | 12 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/Makefile.bsd-wrapper | 31 |
3 files changed, 72 insertions, 17 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.105 2004/10/16 15:28:14 grange Exp $ +# $OpenBSD: Makefile,v 1.106 2004/10/21 20:47:29 grange Exp $ # # For more information on building in tricky environments, please see @@ -187,13 +187,15 @@ NEW_BINUTILS?= No ${CROSSBINUTILS}: ${CROSSINCLUDES} .if ${NEW_BINUTILS:L} == "yes" - export BSDSRCDIR=${.CURDIR}; \ - (cd ${CROSSDIR}/usr/obj/gnu/usr.bin/binutils; \ - /bin/sh ${BSDSRCDIR}/gnu/usr.bin/binutils/configure \ - --prefix ${CROSSDIR}/usr \ - --disable-nls --disable-gdbtk --disable-commonbfdlib \ - --target `cat ${CROSSDIR}/TARGET_CANON` && \ - ${MAKE} CFLAGS="${CFLAGS}" && ${MAKE} install ) + (cd ${.CURDIR}/gnu/usr.bin/binutils; \ + MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ + TARGET_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + ${MAKE} -f Makefile.bsd-wrapper depend && \ + MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ + TARGET_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ + ${MAKE} -f Makefile.bsd-wrapper all && \ + DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ + ${MAKE} -f Makefile.bsd-wrapper install) .else (cd ${.CURDIR}/gnu/usr.bin/gas; \ TARGET_MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \ @@ -253,10 +255,37 @@ ${CROSSBINUTILS}: ${CROSSINCLUDES} ln -sf ${CROSSDIR}/usr/bin/$$cmd \ ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-$$cmd; \ fi ;\ + if [ -e ${CROSSDIR}/usr/bin/$$cmd -a \ + ! -e ${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/$$cmd ]; then \ + ln -sf ${CROSSDIR}/usr/bin/$$cmd \ + ${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/$$cmd; \ + fi ;\ done @touch ${CROSSBINUTILS} +# bsd.own.mk can't do it for us +.if ${TARGET} == "amd64" || ${TARGET} == "cats" || \ + ${TARGET} == "hppa" || ${TARGET} == "hppa64" || \ + ${TARGET} == "sparc64" || ${TARGET} == "sgi" +USE_GCC3=yes +.endif + ${CROSSGCC}: ${CROSSBINUTILS} +.if ${USE_GCC3:L} == "yes" + (cd ${.CURDIR}/gnu/usr.bin/gcc; \ + MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ + TARGET_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` CROSSDIR=${CROSSDIR} \ + ${MAKE} -f Makefile.bsd-wrapper depend && \ + MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ + TARGET_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` CROSSDIR=${CROSSDIR} \ + ${MAKE} -f Makefile.bsd-wrapper all && \ + DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \ + ${MAKE} -f Makefile.bsd-wrapper install) + ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-g++ \ + ${CROSSDIR}/usr/bin/c++ + ln -sf ${CROSSDIR}/usr/libexec/cpp \ + ${CROSSDIR}/usr/bin/cpp +.else (cd ${CROSSDIR}/usr/obj/gnu/egcs/gcc; \ /bin/sh ${.CURDIR}/gnu/egcs/gcc/configure \ --with-gnu-as --with-gnu-ld --prefix ${CROSSDIR}/usr \ @@ -285,6 +314,7 @@ ${CROSSGCC}: ${CROSSBINUTILS} ${.CURDIR}/usr.bin/cpp/cpp.sh > ${CROSSDIR}/usr/bin/cpp chmod ${BINMODE} ${CROSSDIR}/usr/bin/cpp chown ${BINOWN}:${BINGRP} ${CROSSDIR}/usr/bin/cpp +.endif @touch ${CROSSGCC} # XXX MAKEOBJDIR maybe should be obj.${TARGET} here, revisit later diff --git a/gnu/usr.bin/binutils/Makefile.bsd-wrapper b/gnu/usr.bin/binutils/Makefile.bsd-wrapper index 80c33cf1646..dd719dcaf1e 100644 --- a/gnu/usr.bin/binutils/Makefile.bsd-wrapper +++ b/gnu/usr.bin/binutils/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.58 2004/06/01 23:01:44 drahn Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.59 2004/10/21 20:47:29 grange Exp $ NEW_BINUTILS=alpha arm hppa i386 mips powerpc sparc sparc64 amd64 @@ -65,6 +65,13 @@ CONFIGURE_HOST_MODULES=${CONF_SUBDIRS:S/^/configure-/g} ALL_HOST_MODULES=${SUBDIRS:S/^/all-/g} INSTALL_MODULES=${INST_SUBDIRS:S/^/install-/g} +# cross-compilation +.if defined(TARGET_ARCH) +CONFIGTARGET=--target=${TARGET_ARCH}-unknown-openbsd${OSREV} +.else +CONFIGTARGET= +.endif + all: config.status SUBDIRS='${SUBDIRS}' \ CONFIGURE_HOST_MODULES='${CONFIGURE_HOST_MODULES}' \ @@ -94,7 +101,8 @@ do-config: .USE PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ sh ${.CURDIR}/configure --prefix=${PREFIX} \ --infodir='$${prefix}/share/info' \ - --disable-nls --disable-gdbtk --disable-commonbfdlib ${CF} + --disable-nls --disable-gdbtk --disable-commonbfdlib ${CF} \ + ${CONFIGTARGET} cd ${.OBJDIR} && \ sed -e 's,SUBDIRS *=,SUBDIRS ?=,' <Makefile >Makefile.tmp && \ mv -f Makefile.tmp Makefile diff --git a/gnu/usr.bin/gcc/Makefile.bsd-wrapper b/gnu/usr.bin/gcc/Makefile.bsd-wrapper index 8b385b9ac68..91d21b3b1c1 100644 --- a/gnu/usr.bin/gcc/Makefile.bsd-wrapper +++ b/gnu/usr.bin/gcc/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.49 2004/09/06 09:01:05 pefo Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.50 2004/10/21 20:47:29 grange Exp $ MAN= gcc.1 cpp.1 gcov.1 protoize.1 MLINKS+= protoize.1 unprotoize.1 @@ -65,8 +65,23 @@ M_ARCH= ${MACHINE_ARCH} GCCARCH= ${M_ARCH}-unknown-openbsd${OSREV} GCCINC= /usr/lib/gcc-lib/${GCCARCH}/$V/include +# cross-compilation +.if defined(TARGET_ARCH) && defined(CROSSDIR) +CONFIGTARGET= --target=${TARGET_ARCH}-unknown-openbsd${OSREV} +CONFIGPREFIX= ${CROSSDIR}/usr +MAKE_FLAGS+= GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" +PATH= /bin:/usr/bin:/sbin:/usr/sbin:${CROSSDIR}/usr/bin +GXX_INCDIR= ${CROSSDIR}/usr/include/g++ +GNUCFLAGS= ${CFLAGS} ${COPTS} -I${LIBIBERTY_INCLUDES} +VAXHOST_CFLAGS= -DIN_GCC -DHAVE_CONFIG_H -O0 +.else +CONFIGTARGET= +CONFIGPREFIX= /usr +PATH= /bin:/usr/bin:/sbin:/usr/sbin +.endif + all: config.status - exec ${MAKE} ${MAKE_FLAGS} all doc proto + exec env PATH="${PATH}" ${MAKE} ${MAKE_FLAGS} all doc proto tconfig.h: config.status exec ${MAKE} ${MAKE_FLAGS} tconfig.h @@ -86,14 +101,15 @@ CF= .endif config.status: gcc/Makefile.in gcc/configure gcc/c-parse.in - PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ + PATH="${PATH}" \ INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \ CPPFLAGS=-I${LIBIBERTY_INCLUDES} \ /bin/sh ${.CURDIR}/gcc/configure --with-gnu-as --with-gnu-ld \ - --prefix=/usr --mandir='$$(prefix)/share/man' \ + --prefix=${CONFIGPREFIX} --mandir='$$(prefix)/share/man' \ --with-local-prefix=/usr ${CF} \ ${LANGUAGES} --enable-cpp --disable-nls \ - --with-gxx-include-dir=${GXX_INCDIR} ${GCCARCH} && touch config.status + --with-gxx-include-dir=${GXX_INCDIR} \ + ${CONFIGTARGET} ${GCCARCH} && touch config.status .ifdef NOMAN maninstall: @@ -138,8 +154,9 @@ install: maninstall target_path ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -m 755 xgcc \ ${DESTDIR}/usr/bin/gcc ln -f ${DESTDIR}/usr/bin/gcc ${DESTDIR}/usr/bin/cc - [ -f ${DESTDIR}/usr/bin/g77 ] && \ - ln -f ${DESTDIR}/usr/bin/g77 ${DESTDIR}/usr/bin/f77 + if [ -f ${DESTDIR}/usr/bin/g77 ]; then \ + ln -f ${DESTDIR}/usr/bin/g77 ${DESTDIR}/usr/bin/f77; \ + fi # ln -fs `cat target-path`/cpp \ # ${DESTDIR}/usr/libexec for i in ${FAKE_FILES}; do \ |