configure 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # set environment variables used by scripts/make.sh
  3. # People run ./configure out of habit, so do "defconfig" for them.
  4. if [ "$(basename "$0")" == configure ]
  5. then
  6. echo "Assuming you want 'make defconfig', but you should probably check the README."
  7. make defconfig
  8. exit $?
  9. fi
  10. # Warn about stuff, disable stupid warnings, be 8-bit clean for utf8.
  11. CFLAGS="$CFLAGS -Wall -Wundef -Wno-char-subscripts -Werror=implicit-function-declaration -Wno-char-subscripts -Wno-pointer-sign -Wno-string-plus-int -funsigned-char"
  12. # Set default values if variable not already set
  13. : ${CC:=cc} ${HOSTCC:=cc} ${GENDIR:=generated} ${KCONFIG_CONFIG:=.config}
  14. : ${OUTNAME:=toybox${TARGET:+-$TARGET}}
  15. : ${OPTIMIZE:=-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-strict-aliasing}
  16. # set ASAN=1 to enable "address sanitizer" and debuggable backtraces
  17. [ -z "$ASAN" ] || { CFLAGS="$CFLAGS -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address"; NOSTRIP=1; }
  18. # We accept LDFLAGS, but by default don't have anything in it
  19. if [ "$(uname)" == "Darwin" ]
  20. then
  21. : ${LDOPTIMIZE:=-Wl,-dead_strip} ${STRIP:=strip}
  22. else
  23. : ${LDOPTIMIZE:=-Wl,--gc-sections -Wl,--as-needed} ${STRIP:=strip -s -R .note* -R .comment}
  24. # LDASNEEDED="-Wl,--as-needed" # must go at end of compiler command line
  25. fi