2018-02-04 18:07:12 -08:00
|
|
|
#!/bin/bash
|
2008-01-19 15:08:39 -08:00
|
|
|
|
|
|
|
# This sets environment variables used by scripts/make.sh
|
|
|
|
|
2018-02-04 18:07:12 -08:00
|
|
|
# People run ./configure out of habit, so do "defconfig" for them.
|
|
|
|
|
|
|
|
if [ "$(basename "$0")" == configure ]
|
|
|
|
then
|
|
|
|
echo "Assuming you want 'make defconfig', but you should probably check the README."
|
|
|
|
make defconfig
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2008-01-19 15:08:39 -08:00
|
|
|
# A synonym.
|
|
|
|
[ -z "$CROSS_COMPILE" ] && CROSS_COMPILE="$CROSS"
|
2015-02-28 10:39:16 -08:00
|
|
|
|
|
|
|
# CFLAGS and OPTIMIZE are different so you can add extra CFLAGS without
|
|
|
|
# disabling default optimizations
|
2017-01-04 12:19:06 -08:00
|
|
|
[ -z "$CFLAGS" ] && CFLAGS="-Wall -Wundef -Wno-char-subscripts -Werror=implicit-function-declaration"
|
2012-06-18 21:23:24 -07:00
|
|
|
# Required for our expected ABI. we're 8-bit clean thus "char" must be unsigned.
|
2008-01-19 15:08:39 -08:00
|
|
|
CFLAGS="$CFLAGS -funsigned-char"
|
2015-09-16 23:49:48 -07:00
|
|
|
[ -z "$OPTIMIZE" ] && OPTIMIZE="-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-strict-aliasing"
|
2015-02-28 10:39:16 -08:00
|
|
|
|
|
|
|
# We accept LDFLAGS, but by default don't have anything in it
|
2014-08-30 15:44:07 -07:00
|
|
|
[ -z "$LDOPTIMIZE" ] && LDOPTIMIZE="-Wl,--gc-sections"
|
2015-02-28 10:39:16 -08:00
|
|
|
|
2015-10-05 18:47:49 -07:00
|
|
|
# The makefile provides defaults for these, so this only gets used if
|
|
|
|
# you call scripts/make.sh and friends directly.
|
|
|
|
|
2012-03-03 08:56:11 -08:00
|
|
|
[ -z "$CC" ] && CC=cc
|
2012-06-18 21:23:24 -07:00
|
|
|
|
2015-02-28 10:39:16 -08:00
|
|
|
# If HOSTCC needs CFLAGS or LDFLAGS, just add them to the variable
|
|
|
|
# ala HOSTCC="blah-cc --static"
|
2015-10-05 18:47:49 -07:00
|
|
|
[ -z "$HOSTCC" ] && HOSTCC=cc
|