aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>1999-12-29 14:42:46 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>1999-12-29 14:42:46 +0000
commit253745e1fcdf59096ca0ba95817be35571ceba24 (patch)
treefa2b68df2c96c1e2576742f3fc3f257c971eb41e /gnu
parent19c5221906d4c333f3ad523f45655b2b6ecf4dc7 (diff)
downloadsrc-253745e1fcdf59096ca0ba95817be35571ceba24.tar.gz
src-253745e1fcdf59096ca0ba95817be35571ceba24.zip
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)
Notes
Notes: svn path=/head/; revision=55220
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/cc/Makefile.inc15
-rw-r--r--gnu/usr.bin/cc/cc_drv/Makefile1
-rw-r--r--gnu/usr.bin/cc/cc_tools/freebsd-native.h13
3 files changed, 15 insertions, 14 deletions
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