74 lines
2.2 KiB
Plaintext
Raw Normal View History

2016-09-05 01:06:38 -07:00
GCC_OPTIM="-Os"
LD_OPTIM="-Wl,--as-needed"
if [ "$LTO_SUPPORT" = yes ];then
GCC_OPTIM_LTO="-flto -ffat-lto-objects"
LD_OPTIM_LTO="-fuse-linker-plugin -flto"
fi
if [ "$GOLD_SUPPORT" = yes ];then
LD_OPTIM_GOLD="-fuse-ld=gold"
fi
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"
fi
TARGET_CPPFLAGS=
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -pipe $GCC_OPTIM $GCC_OPTIM_LTO $PROJECT_CFLAGS"
TARGET_CXXFLAGS="$TARGET_CFLAGS"
TARGET_LDFLAGS="$TARGET_LDFLAGS $LD_OPTIM $LD_OPTIM_GOLD $LD_OPTIM_LTO"
TARGET_LIBDIR="$SYSROOT_PREFIX/lib $SYSROOT_PREFIX/usr/lib"
TARGET_INCDIR="$SYSROOT_PREFIX/include $SYSROOT_PREFIX/usr/include"
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"
HOST_LIBDIR="$ROOT/$TOOLCHAIN/lib"
# 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"
# 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
HOST_LIBDIR="$HOST_LIBDIR /lib/$FAMILY_TRIPLET"
fi
if [ -d /usr/lib/$FAMILY_TRIPLET ]; then
HOST_LIBDIR="$HOST_LIBDIR /usr/lib/$FAMILY_TRIPLET"
fi
# default multiarch support
case "`uname -m`" in
i*86)
if [ -d /lib32 ]; then
HOST_LIBDIR="$HOST_LIBDIR /lib32"
fi
if [ -d /usr/lib32 ]; then
HOST_LIBDIR="$HOST_LIBDIR /usr/lib32"
fi
;;
x86_64)
if [ -d /lib64 ]; then
HOST_LIBDIR="$HOST_LIBDIR /lib64"
fi
if [ -d /usr/lib64 ]; then
HOST_LIBDIR="$HOST_LIBDIR /usr/lib64"
fi
;;
esac
# default dirs
HOST_LIBDIR="$HOST_LIBDIR /lib /usr/lib"
HOST_INCDIR="$ROOT/$TOOLCHAIN/include /usr/include"