cross: fix crossdir export

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cross: fix crossdir export

Patrick Wildt-3
Hi,

we now have at least two parts of the build system depend on CROSSDIR to
check for a cross-compile environment (ld.so + binutils).  Unfortunately
we never really exported CROSSDIR for those so the checks never worked.

This diff exports CROSSDIR for binutils, moves the CROSSDIR define
around in the GCC case so that it looks like the rest of the Makefile,
and it exports CROSSDIR in the CROSSENV, which is used for all binaries
including ld.so.

ok?

Patrick

diff --git a/Makefile.cross b/Makefile.cross
index 3f2d251acc4..e79ac07a5c0 100644
--- a/Makefile.cross
+++ b/Makefile.cross
@@ -62,7 +62,8 @@ CROSSENV= AR=${CROSSDIR}/usr/${TARGET_CANON}/bin/ar \
  HOSTLDFLAGS=\"${LDFLAGS}\" \
  CFLAGS=\"${CROSSCFLAGS}\" CPPFLAGS=\"${CROSSCPPFLAGS}\" \
  CXXFLAGS=\"${CROSSCXXFLAGS}\" \
- LDFLAGS=\"${CROSSLDFLAGS}\"
+ LDFLAGS=\"${CROSSLDFLAGS}\" \
+ CROSSDIR=\"${CROSSDIR}\"
 CROSSADDPATH=:${CROSSDIR}/usr/${TARGET_CANON}/bin
 CROSSPATH= /usr/bin:/bin:/usr/sbin:/sbin${CROSSADDPATH}
 CROSSLANGS?= c c++
@@ -181,19 +182,21 @@ ${CROSSINCLUDES}: ${CROSSOBJ}
 
 ${CROSSBINUTILS}: ${CROSSINCLUDES}
  (cd ${.CURDIR}/${BINUTILS_DIR}; \
+    env CROSSDIR=${CROSSDIR} \
     MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
     PIE_DEFAULT=${PIE_DEFAULT} \
     TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
     PATH=${CROSSPATH} \
     ${MAKE} -f Makefile.bsd-wrapper depend && \
+    env CROSSDIR=${CROSSDIR} \
     MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
     PIE_DEFAULT=${PIE_DEFAULT} \
     TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
     ${MAKE} -f Makefile.bsd-wrapper all && \
-    DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
+    env CROSSDIR=${CROSSDIR} DESTDIR=${CROSSDIR} \
     COMPILER_VERSION=${COMPILER_VERSION} \
-    PIE_DEFAULT=${PIE_DEFAULT} \
     MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
+    PIE_DEFAULT=${PIE_DEFAULT} \
     TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
     ${MAKE} -f Makefile.bsd-wrapper install)
  @for cmd in ${BINUTILS}; do \
@@ -274,17 +277,17 @@ ${CROSSGCC}: ${CROSSBINUTILS}
  ln -sf ${TARGET_CANON}-cpp ${CROSSDIR}/usr/${TARGET_CANON}/bin/cpp
 .else
  (cd ${.CURDIR}/gnu/usr.bin/cc; \
+    env CROSSDIR=${CROSSDIR} \
     PIE_DEFAULT=${PIE_DEFAULT} \
     MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
     TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
-    CROSSDIR=${CROSSDIR} \
     MACHINE=${TARGET} \
     PATH=${CROSSPATH} ${MAKE} depend  )
  (cd ${.CURDIR}/gnu/usr.bin/cc; \
+    env CROSSDIR=${CROSSDIR} \
     PIE_DEFAULT=${PIE_DEFAULT} \
     MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
     TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
-    CROSSDIR=${CROSSDIR} \
     MACHINE=${TARGET} \
     ${MAKE} all )
  (cd ${.CURDIR}/gnu/usr.bin/cc; \

Loading...