2016-09-05 01:06:38 -07:00
|
|
|
GCC_OPTIM="-Os"
|
|
|
|
LD_OPTIM="-Wl,--as-needed"
|
2010-11-28 15:11:08 +01:00
|
|
|
|
2011-07-12 01:47:26 +02:00
|
|
|
if [ "$LTO_SUPPORT" = yes ];then
|
2014-04-23 18:33:34 +02:00
|
|
|
GCC_OPTIM_LTO="-flto -ffat-lto-objects"
|
|
|
|
LD_OPTIM_LTO="-fuse-linker-plugin -flto"
|
2011-07-12 01:47:26 +02:00
|
|
|
fi
|
2011-07-10 23:24:31 +02:00
|
|
|
|
2013-05-12 14:10:00 +02:00
|
|
|
if [ "$GOLD_SUPPORT" = yes ];then
|
2014-04-23 18:33:34 +02:00
|
|
|
LD_OPTIM_GOLD="-fuse-ld=gold"
|
2013-05-12 14:10:00 +02:00
|
|
|
fi
|
|
|
|
|
2011-03-23 03:07:20 +01:00
|
|
|
if [ "$DEBUG" = yes ]; then
|
|
|
|
TARGET_CFLAGS="$TARGET_CFLAGS -ggdb"
|
|
|
|
TARGET_CXXFLAGS="$TARGET_CXXFLAGS -ggdb"
|
|
|
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -ggdb"
|
|
|
|
else
|
|
|
|
TARGET_CFLAGS="$TARGET_CFLAGS -fomit-frame-pointer"
|
|
|
|
TARGET_CXXFLAGS="$TARGET_CXXFLAGS -fomit-frame-pointer"
|
2016-01-31 00:21:33 +01:00
|
|
|
TARGET_LDFLAGS="$TARGET_LDFLAGS"
|
2011-03-23 03:07:20 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
TARGET_CPPFLAGS=
|
2014-04-23 18:33:34 +02:00
|
|
|
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -pipe $GCC_OPTIM $GCC_OPTIM_LTO $PROJECT_CFLAGS"
|
2011-03-23 03:07:20 +01:00
|
|
|
TARGET_CXXFLAGS="$TARGET_CFLAGS"
|
2014-09-03 22:59:33 +02:00
|
|
|
TARGET_LDFLAGS="$TARGET_LDFLAGS $LD_OPTIM $LD_OPTIM_GOLD $LD_OPTIM_LTO"
|
2011-07-13 22:04:29 +02:00
|
|
|
TARGET_LIBDIR="$SYSROOT_PREFIX/lib $SYSROOT_PREFIX/usr/lib"
|
|
|
|
TARGET_INCDIR="$SYSROOT_PREFIX/include $SYSROOT_PREFIX/usr/include"
|
2011-03-23 03:07:20 +01:00
|
|
|
|
|
|
|
HOST_CPPFLAGS=""
|
|
|
|
HOST_CFLAGS="-O2 -Wall -pipe -I$ROOT/$TOOLCHAIN/include"
|
|
|
|
HOST_CXXFLAGS="$HOST_CFLAGS"
|
|
|
|
HOST_LDFLAGS="-Wl,-rpath,$ROOT/$TOOLCHAIN/lib -L$ROOT/$TOOLCHAIN/lib"
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$ROOT/$TOOLCHAIN/lib"
|
2011-03-23 03:07:20 +01:00
|
|
|
|
2013-12-25 18:14:33 +01:00
|
|
|
# work around Ubuntu default C*FLAGS
|
|
|
|
# see https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wformat_-Wformat-security
|
|
|
|
HOST_CFLAGS="$HOST_CFLAGS -Wno-format-security"
|
|
|
|
HOST_CXXFLAGS="$HOST_CXXFLAGS -Wno-format-security"
|
|
|
|
|
2011-07-13 03:09:12 +02:00
|
|
|
# add distro specific library dirs
|
|
|
|
# ubuntu/debian specific "multiarch support"
|
|
|
|
FAMILY_TRIPLET=$(echo $HOST_NAME | sed -e "s,$(uname -m),$(uname -i),")
|
|
|
|
if [ -d /lib/$FAMILY_TRIPLET ]; then
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /lib/$FAMILY_TRIPLET"
|
2011-07-13 03:09:12 +02:00
|
|
|
fi
|
|
|
|
if [ -d /usr/lib/$FAMILY_TRIPLET ]; then
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /usr/lib/$FAMILY_TRIPLET"
|
2011-07-13 03:09:12 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# default multiarch support
|
|
|
|
case "`uname -m`" in
|
|
|
|
i*86)
|
|
|
|
if [ -d /lib32 ]; then
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /lib32"
|
2011-07-13 03:09:12 +02:00
|
|
|
fi
|
|
|
|
if [ -d /usr/lib32 ]; then
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /usr/lib32"
|
2011-07-13 03:09:12 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
x86_64)
|
|
|
|
if [ -d /lib64 ]; then
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /lib64"
|
2011-07-13 03:09:12 +02:00
|
|
|
fi
|
|
|
|
if [ -d /usr/lib64 ]; then
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /usr/lib64"
|
2011-07-13 03:09:12 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# default dirs
|
2011-07-13 22:04:29 +02:00
|
|
|
HOST_LIBDIR="$HOST_LIBDIR /lib /usr/lib"
|
|
|
|
HOST_INCDIR="$ROOT/$TOOLCHAIN/include /usr/include"
|