Reorganize build options

At present, various build options are initialized at various places in
the Makefile. This patch gathers all build option declarations at the
top of the Makefile and assigns them default values.

Change-Id: I9f527bc8843bf69c00cb754dc60377bdb407a951
This commit is contained in:
Jeenu Viswambharan 2014-05-15 14:40:58 +01:00
parent 289e0dadbd
commit e35c404599
1 changed files with 33 additions and 35 deletions

View File

@ -28,13 +28,24 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
# #
# Decrease the verbosity of the make script #
# can be made verbose by passing V=1 at the make command line # Default values for build configurations
ifdef V #
KBUILD_VERBOSE = ${V}
else # Build verbosity
KBUILD_VERBOSE = 0 V := 0
endif # Debug build
DEBUG := 0
# Build architecture
ARCH := aarch64
# Build platform
DEFAULT_PLAT := fvp
PLAT := ${DEFAULT_PLAT}
# SPD choice
SPD := none
# Base commit to perform code check on
BASE_COMMIT := origin/master
# Checkpatch ignores # Checkpatch ignores
CHECK_IGNORE = --ignore COMPLEX_MACRO CHECK_IGNORE = --ignore COMPLEX_MACRO
@ -42,17 +53,14 @@ CHECK_IGNORE = --ignore COMPLEX_MACRO
CHECKPATCH_ARGS = --no-tree --no-signoff ${CHECK_IGNORE} CHECKPATCH_ARGS = --no-tree --no-signoff ${CHECK_IGNORE}
CHECKCODE_ARGS = --no-patch --no-tree --no-signoff ${CHECK_IGNORE} CHECKCODE_ARGS = --no-patch --no-tree --no-signoff ${CHECK_IGNORE}
ifeq "${KBUILD_VERBOSE}" "0" ifeq (${V},0)
Q=@ Q=@
CHECKCODE_ARGS += --no-summary --terse CHECKCODE_ARGS += --no-summary --terse
else else
Q= Q=
endif endif
export Q export Q
DEBUG ?= 0
ifneq (${DEBUG}, 0) ifneq (${DEBUG}, 0)
BUILD_TYPE := debug BUILD_TYPE := debug
else else
@ -68,14 +76,6 @@ BL_COMMON_SOURCES := common/bl_common.c \
lib/io_storage.c \ lib/io_storage.c \
plat/common/aarch64/platform_helpers.S plat/common/aarch64/platform_helpers.S
ARCH ?= aarch64
# By default, build fvp platform
DEFAULT_PLAT := fvp
PLAT ?= ${DEFAULT_PLAT}
# By default, build no SPD component
SPD ?= none
BUILD_BASE := ./build BUILD_BASE := ./build
BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
@ -161,28 +161,28 @@ INCLUDES += -Iinclude/bl1 \
${PLAT_INCLUDES} \ ${PLAT_INCLUDES} \
${SPD_INCLUDES} ${SPD_INCLUDES}
# Process DEBUG flag
$(eval $(call assert_boolean,DEBUG))
$(eval $(call add_define,DEBUG))
ifeq (${DEBUG},0)
$(eval $(call add_define,NDEBUG))
else
CFLAGS += -g
ASFLAGS += -g -Wa,--gdwarf-2
endif
ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \ ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
-mgeneral-regs-only -D__ASSEMBLY__ ${INCLUDES} \ -mgeneral-regs-only -D__ASSEMBLY__ \
-DDEBUG=${DEBUG} ${DEFINES} ${INCLUDES}
CFLAGS := -nostdinc -pedantic -ffreestanding -Wall \ CFLAGS += -nostdinc -pedantic -ffreestanding -Wall \
-Werror -mgeneral-regs-only -std=c99 -c -Os \ -Werror -mgeneral-regs-only -std=c99 -c -Os \
-DDEBUG=${DEBUG} ${INCLUDES} ${CFLAGS} ${DEFINES} ${INCLUDES}
CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += --fatal-warnings -O1 LDFLAGS += --fatal-warnings -O1
LDFLAGS += --gc-sections LDFLAGS += --gc-sections
ifneq (${DEBUG}, 0)
#CFLAGS += -g -O0
CFLAGS += -g
# -save-temps -fverbose-asm
ASFLAGS += -g -Wa,--gdwarf-2
else
CFLAGS += -DNDEBUG=1
endif
CC := ${CROSS_COMPILE}gcc CC := ${CROSS_COMPILE}gcc
CPP := ${CROSS_COMPILE}cpp CPP := ${CROSS_COMPILE}cpp
AS := ${CROSS_COMPILE}gcc AS := ${CROSS_COMPILE}gcc
@ -193,8 +193,6 @@ OD := ${CROSS_COMPILE}objdump
NM := ${CROSS_COMPILE}nm NM := ${CROSS_COMPILE}nm
PP := ${CROSS_COMPILE}gcc -E ${CFLAGS} PP := ${CROSS_COMPILE}gcc -E ${CFLAGS}
BASE_COMMIT ?= origin/master
# Variables for use with Firmware Image Package # Variables for use with Firmware Image Package
FIPTOOLPATH ?= tools/fip_create FIPTOOLPATH ?= tools/fip_create
FIPTOOL ?= ${FIPTOOLPATH}/fip_create FIPTOOL ?= ${FIPTOOLPATH}/fip_create