summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2016-04-11 13:01:17 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2016-04-14 16:16:37 +0100
commit403973c95daa62b8411f789a8a93ef9e18b7f980 (patch)
treed5390c0506b5a4bd3c90c7576625f41bae32bb30 /Makefile
parent43b97eda2592d19832da8e93b77fea94acc1c869 (diff)
Give user's compiler flags precedence over default ones
The user can provide additional CFLAGS to use when building TF. However, these custom CFLAGS are currently prepended to the standard CFLAGS that are hardcoded in the TF build system. This is an issue because when providing conflicting compiler flags (e.g. different optimisations levels like -O1 and -O0), the last one on the command line usually takes precedence. This means that the user flags get overriden. To address this problem, this patch separates the TF CFLAGS from the user CFLAGS. The former are now stored in the TF_CFLAGS make variable, whereas the CFLAGS make variable is untouched and reserved for the user. The order of the 2 sets of flags is enforced when invoking the compiler. Fixes ARM-Software/tf-issues#350 Change-Id: Ib189f44555b885f1dffbec6015092f381600e560
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 5 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c5ec6d1c..b1560a2b 100644
--- a/Makefile
+++ b/Makefile
@@ -136,7 +136,7 @@ export Q
$(eval $(call add_define,DEBUG))
ifneq (${DEBUG}, 0)
BUILD_TYPE := debug
- CFLAGS += -g
+ TF_CFLAGS += -g
ASFLAGS += -g -Wa,--gdwarf-2
# Use LOG_LEVEL_INFO by default for debug builds
LOG_LEVEL := 40
@@ -179,12 +179,12 @@ ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
-Werror -Wmissing-include-dirs \
-mgeneral-regs-only -D__ASSEMBLY__ \
${DEFINES} ${INCLUDES}
-CFLAGS += -nostdinc -ffreestanding -Wall \
+TF_CFLAGS += -nostdinc -ffreestanding -Wall \
-Werror -Wmissing-include-dirs \
-mgeneral-regs-only -mstrict-align \
-std=c99 -c -Os \
${DEFINES} ${INCLUDES}
-CFLAGS += -ffunction-sections -fdata-sections
+TF_CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += --fatal-warnings -O1
LDFLAGS += --gc-sections
@@ -331,7 +331,7 @@ endif
# Check if -pedantic option should be used
ifeq (${DISABLE_PEDANTIC},0)
- CFLAGS += -pedantic
+ TF_CFLAGS += -pedantic
endif
# Using the ARM Trusted Firmware BL2 implies that a BL33 image also needs to be
@@ -487,7 +487,7 @@ msg_start:
# Check if deprecated declarations should be treated as error or not.
ifeq (${ERROR_DEPRECATED},0)
- CFLAGS += -Wno-error=deprecated-declarations
+ TF_CFLAGS += -Wno-error=deprecated-declarations
endif
# Expand build macros for the different images