diff options
author | joerg <joerg@pkgsrc.org> | 2007-08-02 18:19:31 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2007-08-02 18:19:31 +0000 |
commit | 005620851f14ccfbf69fb7ccaffc6f6e6d0f968a (patch) | |
tree | 7eeb466964543e6a95e208d441bf203db2c07e58 /mk/compiler | |
parent | 6989e7a043e210e423d5d0252d903c71166a1096 (diff) | |
download | pkgsrc-005620851f14ccfbf69fb7ccaffc6f6e6d0f968a.tar.gz |
Add core of the infrastructure support for cross-compilation.
- USE_CROSS_COMPILATION activates it, CROSS_DESTDIR specifies root of
the target filesystem
- derive _CROSS_DESTDIR from CROSS_DESTDIR or MAKEOBJDIR
- buildlink3.mk prefixes the files to symlink with _CROSS_DESTDIR
- compiler/gcc.mk knows about the target prefix (e.g. i386--netbsdelf)
- PKG_DBDIR is prefixed with _CROSS_DESTDIR
- package-install and bin-install are not called with su
- install and strip are redirected to the tool version
- links for the target specific ar, as, ld, nm, objdump, ranlib and
strip are added
- compiler wrapper detect if linking is requested or not
- special command sinks for CPP and CC/CXX add the cross-compile magic:
- modify include dirs to get the target /usr/include
- modify linker dirs and runpath to use target /usr/lib at link time,
but keep correct rpath entries
Supported-by: Google SoC 2007
Basic tests by he@ on Sparc. Review from jlam@.
Diffstat (limited to 'mk/compiler')
-rw-r--r-- | mk/compiler/gcc.mk | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk index 6f3ef9e3b24..9af346dcfd4 100644 --- a/mk/compiler/gcc.mk +++ b/mk/compiler/gcc.mk @@ -1,4 +1,4 @@ -# $NetBSD: gcc.mk,v 1.90 2007/02/10 08:59:07 rillig Exp $ +# $NetBSD: gcc.mk,v 1.91 2007/08/02 18:19:32 joerg Exp $ # # This is the compiler definition for the GNU Compiler Collection. # @@ -353,33 +353,36 @@ _GCCBINDIR= ${_GCC_PREFIX}bin .elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS]) _GCCBINDIR= ${_CC:H} .endif -.if exists(${_GCCBINDIR}/gcc) +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +_GCC_BIN_PREFIX= ${MACHINE_GNU_PLATFORM}- +.endif +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc) _GCC_VARS+= CC -_GCC_CC= ${_GCC_DIR}/bin/gcc +_GCC_CC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gcc _ALIASES.CC= cc gcc -CCPATH= ${_GCCBINDIR}/gcc +CCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc PKG_CC:= ${_GCC_CC} .endif -.if exists(${_GCCBINDIR}/cpp) +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp) _GCC_VARS+= CPP -_GCC_CPP= ${_GCC_DIR}/bin/cpp +_GCC_CPP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}cpp _ALIASES.CPP= cpp -CPPPATH= ${_GCCBINDIR}/cpp +CPPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp PKG_CPP:= ${_GCC_CPP} .endif -.if exists(${_GCCBINDIR}/g++) +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++) _GCC_VARS+= CXX -_GCC_CXX= ${_GCC_DIR}/bin/g++ +_GCC_CXX= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g++ _ALIASES.CXX= c++ g++ -CXXPATH= ${_GCCBINDIR}/g++ +CXXPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++ PKG_CXX:= ${_GCC_CXX} .endif -.if exists(${_GCCBINDIR}/g77) +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77) _GCC_VARS+= FC -_GCC_FC= ${_GCC_DIR}/bin/g77 +_GCC_FC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g77 _ALIASES.FC= f77 g77 -FCPATH= ${_GCCBINDIR}/g77 -F77PATH= ${_GCCBINDIR}/g77 +FCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77 +F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77 PKG_FC:= ${_GCC_FC} .endif _COMPILER_STRIP_VARS+= ${_GCC_VARS} |