diff --git a/build-devkit.sh b/build-devkit.sh index 50e5605..afd5481 100755 --- a/build-devkit.sh +++ b/build-devkit.sh @@ -175,22 +175,26 @@ PLATFORM=`uname -s` case $PLATFORM in Darwin ) - cflags="-mmacosx-version-min=${OSXMIN} -I/usr/local/include" + cppflags="-mmacosx-version-min=${OSXMIN} -I/usr/local/include" ldflags="-mmacosx-version-min=${OSXMIN} -L/usr/local/lib" if [ "x${OSXSDKPATH}x" != "xx" ]; then - cflags="$cflags -isysroot ${OSXSDKPATH}" + cppflags="$cppflags -isysroot ${OSXSDKPATH}" ldflags="$ldflags -Wl,-syslibroot,${OSXSDKPATH}" fi TESTCC=`cc -v 2>&1 | grep clang` if [ "x${TESTCC}x" != "xx" ]; then - cflags="$cflags -fbracket-depth=512" + cppflags="$cppflags -fbracket-depth=512" fi ;; MINGW32* ) - cflags="-D__USE_MINGW_ACCESS" + cppflags="-D__USE_MINGW_ACCESS" ;; esac +if [ ! -z $CROSSBUILD ] && grep -q "mingw" <<<"$CROSSBUILD" ; then + cppflags="-D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1" +fi + BUILDSCRIPTDIR=$(pwd) BUILDDIR=$(pwd)/.$package diff --git a/dkarm-eabi/scripts/build-gcc.sh b/dkarm-eabi/scripts/build-gcc.sh index d3a095f..04d32b8 100755 --- a/dkarm-eabi/scripts/build-gcc.sh +++ b/dkarm-eabi/scripts/build-gcc.sh @@ -10,7 +10,7 @@ cd $target/binutils if [ ! -f configured-binutils ] then - CFLAGS=$cflags LDFLAGS=$ldflags ../../binutils-$BINUTILS_VER/configure \ + CPPFLAGS="$cppflags $CPPFLAGS" LDFLAGS=$ldflags ../../binutils-$BINUTILS_VER/configure \ --prefix=$prefix --target=$target --disable-nls --disable-werror \ --enable-lto --enable-plugins --enable-gold \ $CROSS_PARAMS \ @@ -39,8 +39,7 @@ cd $target/gcc if [ ! -f configured-gcc ] then - CFLAGS="$cflags" \ - CXXFLAGS="$cflags" \ + CPPFLAGS="$cppflags $CPPFLAGS" \ LDFLAGS="$ldflags" \ CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ CXXFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ @@ -194,8 +193,7 @@ PLATFORM=`uname -s` if [ ! -f configured-gdb ] then - CFLAGS="$cflags" \ - CXXFLAGS="$cflags" \ + CPPFLAGS="$cppflags $CPPFLAGS" \ LDFLAGS="$ldflags" \ ../../gdb-$GDB_VER/configure \ --disable-nls --prefix=$prefix --target=$target --disable-werror \ diff --git a/dkarm-eabi/scripts/build-tools.sh b/dkarm-eabi/scripts/build-tools.sh index 273c9bb..fbd61b4 100755 --- a/dkarm-eabi/scripts/build-tools.sh +++ b/dkarm-eabi/scripts/build-tools.sh @@ -6,7 +6,7 @@ do dir=$(echo $archive | sed -e 's/\(.*\)\.tar\.bz2/\1/' ) cd $BUILDDIR/$dir if [ ! -f configured ]; then - CXXFLAGS=$cflags CFLAGS=$cflags LDFLAGS=$ldflags ./configure --prefix=$toolsprefix $CROSS_PARAMS || { echo "error configuring $archive"; exit 1; } + CPPFLAGS="$cppflags $CPPFLAGS" ./configure --prefix=$toolsprefix $CROSS_PARAMS || { echo "error configuring $archive"; exit 1; } touch configured fi if [ ! -f built ]; then