From 253745e1fcdf59096ca0ba95817be35571ceba24 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Wed, 29 Dec 1999 14:42:46 +0000 Subject: [PATCH] Allow the specification of a prefix for gcc to find all the various bits. If one wishes to anchor the compiler toolchain tree somewhere other than /, all one needs to do is set "TOOLS_PREFIX" to a different rooting. Submitted by: marcel (in a different format and reworked by me) --- Makefile.inc1 | 5 +---- contrib/gcc/gcc.c | 6 +++--- gnu/usr.bin/cc/Makefile.inc | 15 +++++++-------- gnu/usr.bin/cc/cc_drv/Makefile | 1 - gnu/usr.bin/cc/cc_tools/freebsd-native.h | 13 ++++++++----- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 3ae46532356e..f68c2a9b14a8 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -144,6 +144,7 @@ BOOTSTRAPENV= MAKEOBJDIRPREFIX=${WORLDTMP} \ DESTDIR=${WORLDTMP} \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ MACHINE_ARCH=${BUILD_ARCH} \ + TOOLS_PREFIX=${WORLDTMP} \ PATH=${TMPPATH} # Common environment for world related stages @@ -473,14 +474,10 @@ includes: cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus; ${MAKE} beforeinstall .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) -.if exists(${.CURDIR}/secure/lib/libcrypto) cd ${.CURDIR}/secure/lib/libcrypto; ${MAKE} beforeinstall -.endif cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall -.if exists(${.CURDIR}/secure/lib/libssl) cd ${.CURDIR}/secure/lib/libssl; ${MAKE} beforeinstall .endif -.endif .if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \ defined(MAKE_KERBEROS4) cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall diff --git a/contrib/gcc/gcc.c b/contrib/gcc/gcc.c index 9c54245538e9..1e4550578fb5 100644 --- a/contrib/gcc/gcc.c +++ b/contrib/gcc/gcc.c @@ -2666,7 +2666,7 @@ process_command (argc, argv) } GET_ENV_PATH_LIST (temp, "LIBRARY_PATH"); - if (temp && *cross_compile == '0') + if (temp) { const char *startp, *endp; char *nstore = (char *) alloca (strlen (temp) + 3); @@ -3083,11 +3083,11 @@ process_command (argc, argv) { case OBJFMT_AOUT: n_switches++; /* add implied -maout */ - add_prefix (&exec_prefixes, "/usr/libexec/aout/", "BINUTILS", + add_prefix (&exec_prefixes, PREFIX"/libexec/aout/", "BINUTILS", 0, 0, NULL_PTR); break; case OBJFMT_ELF: - add_prefix (&exec_prefixes, "/usr/libexec/elf/", "BINUTILS", + add_prefix (&exec_prefixes, PREFIX"/libexec/elf/", "BINUTILS", 0, 0, NULL_PTR); break; case OBJFMT_UNKNOWN: diff --git a/gnu/usr.bin/cc/Makefile.inc b/gnu/usr.bin/cc/Makefile.inc index bb2c45ad01be..e9966864e205 100644 --- a/gnu/usr.bin/cc/Makefile.inc +++ b/gnu/usr.bin/cc/Makefile.inc @@ -6,17 +6,19 @@ .if !defined(GCCDIR) GCCDIR= ${.CURDIR}/../../../../contrib/gcc -.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" +TARGET_ARCH?= ${MACHINE_ARCH} + +.if ${TARGET_ARCH} == "mipsel" || ${TARGET_ARCH} == "mipseb" GCC_ARCH= mips .else -GCC_ARCH= ${MACHINE_ARCH} +GCC_ARCH= ${TARGET_ARCH} .endif # Machine description. MD_FILE= ${GCCDIR}/config/${GCC_ARCH}/${GCC_ARCH}.md OUT_FILE= ${GCC_ARCH}.c OUT_OBJ= ${GCC_ARCH} -target= ${MACHINE_ARCH}-unknown-freebsd +target= ${TARGET_ARCH}-unknown-freebsd # These architectures are Cygnus's default for enabling Haifa. .if ${GCC_ARCH} == "alpha" || ${GCC_ARCH} == "sparc" @@ -28,6 +30,7 @@ version!= sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${GCCDIR}/version.c CFLAGS+= -DFREEBSD_NATIVE -DIN_GCC -DHAVE_CONFIG_H CFLAGS+= -DDEFAULT_TARGET_VERSION=\"$(version)\" CFLAGS+= -DDEFAULT_TARGET_MACHINE=\"$(target)\" +CFLAGS+= -DPREFIX=\"${TOOLS_PREFIX}/usr\" .if defined(LONG_TYPE_SIZE) CFLAGS+= -DLONG_TYPE_SIZE=${LONG_TYPE_SIZE} .endif @@ -36,11 +39,7 @@ CFLAGS+= -DLONG_TYPE_SIZE=${LONG_TYPE_SIZE} CFLAGS+= -DHAIFA .endif -# If hw.machine_arch doesn't match ${MACHINE_ARCH}, then we're cross -# compiling. gcc needs to know about this, so we set the -DCROSS_COMPILE -# define. -__M!= /sbin/sysctl -b hw.machine_arch -.if ${__M} != ${MACHINE_ARCH} +.if ${TARGET_ARCH} != ${MACHINE_ARCH} CFLAGS+= -DCROSS_COMPILE .endif diff --git a/gnu/usr.bin/cc/cc_drv/Makefile b/gnu/usr.bin/cc/cc_drv/Makefile index c486443dedb6..9e8dfc4cb92d 100644 --- a/gnu/usr.bin/cc/cc_drv/Makefile +++ b/gnu/usr.bin/cc/cc_drv/Makefile @@ -6,7 +6,6 @@ SRCS= multilib.h choose-temp.c obstack.c prefix.c pexecute.c version.c -CFLAGS+= -DPREFIX=\"/usr\" CFLAGS+= -DIN_GCC LIB= cc_drv diff --git a/gnu/usr.bin/cc/cc_tools/freebsd-native.h b/gnu/usr.bin/cc/cc_tools/freebsd-native.h index 526095852b68..2a91100c45c5 100644 --- a/gnu/usr.bin/cc/cc_tools/freebsd-native.h +++ b/gnu/usr.bin/cc/cc_tools/freebsd-native.h @@ -10,8 +10,11 @@ #undef LOCAL_INCLUDE_DIR /* We don't wish to support one. */ /* Look for the include files in the system-defined places. */ -#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" -#define GCC_INCLUDE_DIR "/usr/include" +#define GPLUSPLUS_INCLUDE_DIR PREFIX"/include/g++" +#define GCC_INCLUDE_DIR PREFIX"/include" +#ifdef CROSS_COMPILE +#define CROSS_INCLUDE_DIR PREFIX"/include" +#endif /* Under FreeBSD, the normal location of the compiler back ends is the /usr/libexec directory. @@ -30,8 +33,8 @@ #undef TOOLDIR_BASE_PREFIX /* Old?? This is not documented. */ #undef MD_EXEC_PREFIX -#define STANDARD_EXEC_PREFIX "/usr/libexec/" -#define MD_EXEC_PREFIX "/usr/libexec/" +#define STANDARD_EXEC_PREFIX PREFIX"/libexec/" +#define MD_EXEC_PREFIX PREFIX"/libexec/" /* Under FreeBSD, the normal location of the various *crt*.o files is the /usr/lib directory. */ @@ -39,7 +42,7 @@ #undef STANDARD_STARTFILE_PREFIX #undef MD_STARTFILE_PREFIX /* We don't need one for now. */ -#define STANDARD_STARTFILE_PREFIX "/usr/lib/" +#define STANDARD_STARTFILE_PREFIX PREFIX"/lib/" /* FreeBSD is 4.4BSD derived */ #define bsd4_4