Skip to content

Commit

Permalink
Adjust cross-toolchain environment to the changes in the clang build
Browse files Browse the repository at this point in the history
fabric.  Since we now also build and use LLVM's lld we can copy lld to
the proper directory akin to what we do with clang.  Build compiler-rt
early as it is needed for building libc.

"go for it" mpi@
  • Loading branch information
bluerise committed May 23, 2017
1 parent 363044a commit 2870cfe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $OpenBSD: Makefile.cross,v 1.93 2017/03/21 10:41:33 patrick Exp $
# $OpenBSD: Makefile.cross,v 1.94 2017/05/23 14:57:30 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
Expand Down Expand Up @@ -82,6 +82,7 @@ CROSSGCC= ${CROSSDIR}/.gcc_done
.for _arch in ${TARGET_ARCH}
.if !empty(CLANG_ARCH:M${_arch})
COMPILER_VERSION=clang
BUILD_CLANG=yes
.elif !empty(GCC3_ARCH:M${_arch})
COMPILER_VERSION=gcc3
.else
Expand Down Expand Up @@ -231,6 +232,7 @@ ${CROSSGCC}: ${CROSSBINUTILS}
MACHINE_ARCH=${TARGET_ARCH} \
${MAKE} depend)
(cd ${.CURDIR}/gnu/usr.bin/clang; \
CC=clang CXX=clang++ \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
MACHINE_ARCH=${TARGET_ARCH} \
${MAKE} all)
Expand All @@ -241,9 +243,12 @@ ${CROSSGCC}: ${CROSSBINUTILS}
${MAKE} install)
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
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-ld ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-ld
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
ln -sf ${TARGET_CANON}-c++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/c++
ln -sf ${TARGET_CANON}-ld ${CROSSDIR}/usr/${TARGET_CANON}/bin/ld
echo "#!/bin/sh\n${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang --sysroot ${CROSSDIR} \"$$""@\"" > ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc; \
chmod +x ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc;
echo "#!/bin/sh\n${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang --driver-mode=g++ --sysroot ${CROSSDIR} \"$$""@\"" > ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++; \
Expand Down Expand Up @@ -325,7 +330,7 @@ cross-lib: ${CROSSGCC}
BSDOBJDIR=${CROSSDIR}/usr/obj; \
export MACHINE MACHINE_ARCH MACHINE_CPU BSDOBJDIR; \
(cd ${.CURDIR}/lib; \
for lib in csu libc; do \
for lib in csu libcompiler_rt libc; do \
(cd $$lib; \
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} depend all ;\
Expand Down

0 comments on commit 2870cfe

Please sign in to comment.