Skip to content

Commit

Permalink
With clang as cross-compiler we need to tell it where our cross
Browse files Browse the repository at this point in the history
directory is so that the correct include and library paths are used.
For this we create a simple wrapper that calls clang in the correct
mode and also passes the sysroot.

ok kettenis@
  • Loading branch information
bluerise committed Jan 4, 2017
1 parent 93c42b1 commit 05c6891
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Makefile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $OpenBSD: Makefile.cross,v 1.89 2016/12/18 17:03:08 patrick Exp $
# $OpenBSD: Makefile.cross,v 1.90 2017/01/04 17:26:02 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 @@ -238,10 +238,13 @@ ${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++
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
ln -sf ${TARGET_CANON}-c++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/c++
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++; \
chmod +x ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++;
.elif ${COMPILER_VERSION:L} == "gcc3"
(cd ${.CURDIR}/gnu/usr.bin/gcc; \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
Expand Down

0 comments on commit 05c6891

Please sign in to comment.