1 #!/bin/bash 2 3 # This sets environment variables used by scripts/make.sh 4 5 # People run ./configure out of habit, so do "defconfig" for them. 6 7 if [ "$(basename "$0")" == configure ] 8 then 9 echo "Assuming you want 'make defconfig', but you should probably check the README." 10 make defconfig 11 exit $? 12 fi 13 14 # A synonym. 15 [ -z "$CROSS_COMPILE" ] && CROSS_COMPILE="$CROSS" 16 17 # CFLAGS and OPTIMIZE are different so you can add extra CFLAGS without 18 # disabling default optimizations 19 [ -z "$CFLAGS" ] && CFLAGS="-Wall -Wundef -Wno-char-subscripts -Werror=implicit-function-declaration" 20 # Required for our expected ABI. we're 8-bit clean thus "char" must be unsigned. 21 CFLAGS="$CFLAGS -funsigned-char" 22 [ -z "$OPTIMIZE" ] && OPTIMIZE="-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-strict-aliasing" 23 24 # We accept LDFLAGS, but by default don't have anything in it 25 [ -z "$LDOPTIMIZE" ] && LDOPTIMIZE="-Wl,--gc-sections" 26 27 # The makefile provides defaults for these, so this only gets used if 28 # you call scripts/make.sh and friends directly. 29 30 [ -z "$CC" ] && CC=cc 31 32 # If HOSTCC needs CFLAGS or LDFLAGS, just add them to the variable 33 # ala HOSTCC="blah-cc --static" 34 [ -z "$HOSTCC" ] && HOSTCC=cc 35