summaryrefslogtreecommitdiff
path: root/Makefile.cross
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-09-23 12:35:53 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-09-23 12:35:53 +0000
commitdf66c2f24b27ce229f3ae643ffdb3c2f08d0069b (patch)
tree747acdade2661f86d8bde22064572f4abe5e13bc /Makefile.cross
parent6abc5996ef5fb748891f4f815d76113da0830553 (diff)
Compile the cross-compiler in the target's objdir instead of polluting
the host's. This also allows compiling multiple toolchains in parallel. Clean up the clang object files afterwards so it doesn't collide with the cross-compiled compiler build.
Diffstat (limited to 'Makefile.cross')
-rw-r--r--Makefile.cross13
1 files changed, 8 insertions, 5 deletions
diff --git a/Makefile.cross b/Makefile.cross
index 8c7641503db..f16d4f4c2df 100644
--- a/Makefile.cross
+++ b/Makefile.cross
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.cross,v 1.97 2017/09/12 08:16:13 mpi Exp $
+# $OpenBSD: Makefile.cross,v 1.98 2017/09/23 12:35:52 patrick Exp $
cross-tools: cross-includes cross-binutils cross-gcc cross-lib
cross-distrib: cross-tools cross-bin cross-share cross-sys cross-etc-root-var
@@ -231,19 +231,22 @@ ${CROSSBINUTILS}: ${CROSSINCLUDES}
${CROSSGCC}: ${CROSSBINUTILS}
.if ${COMPILER_VERSION:L} == "clang"
(cd ${.CURDIR}/gnu/usr.bin/clang; \
- MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
- MACHINE_ARCH=${TARGET_ARCH} \
- ${MAKE} obj)
- (cd ${.CURDIR}/gnu/usr.bin/clang; \
CC=${CC} CXX=${CXX} \
+ BSDOBJDIR=${CROSSDIR}/usr/obj \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
MACHINE_ARCH=${TARGET_ARCH} \
${MAKE} all)
(cd ${.CURDIR}/gnu/usr.bin/clang; \
DESTDIR=${CROSSDIR} \
+ BSDOBJDIR=${CROSSDIR}/usr/obj \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
MACHINE_ARCH=${TARGET_ARCH} \
${MAKE} install)
+ (cd ${.CURDIR}/gnu/usr.bin/clang; \
+ BSDOBJDIR=${CROSSDIR}/usr/obj \
+ MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
+ MACHINE_ARCH=${TARGET_ARCH} \
+ ${MAKE} clean)
mv ${CROSSDIR}/usr/bin/clang ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang
mv ${CROSSDIR}/usr/bin/clang++ ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang++
mv ${CROSSDIR}/usr/bin/ld ${CROSSDIR}/usr/bin/${TARGET_CANON}-ld