• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7if [ "$(basename "$0")" == configure ]
8then
9  echo "Assuming you want 'make defconfig', but you should probably check the README."
10  make defconfig
11  exit $?
12fi
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.
21CFLAGS="$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
25if [ "$(uname)" != "Darwin" ]
26then
27  [ -z "$LDOPTIMIZE" ] && LDOPTIMIZE="-Wl,--gc-sections"
28  LDASNEEDED="-Wl,--as-needed"
29fi
30
31# The makefile provides defaults for these, so this only gets used if
32# you call scripts/make.sh and friends directly.
33
34[ -z "$CC" ] && CC=cc
35[ -z "$STRIP" ] && STRIP=strip
36
37# If HOSTCC needs CFLAGS or LDFLAGS, just add them to the variable
38# ala HOSTCC="blah-cc --static"
39[ -z "$HOSTCC" ] && HOSTCC=cc
40