summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-01-27 16:44:36 +0800
committerChe-Liang Chiou <clchiou@chromium.org>2011-01-27 16:44:36 +0800
commit34be8273e0fb80a6654deab650e581b0dc9046a4 (patch)
tree80d517508d30dcba168feb0bc9152777b939625f
parent9f1973e271937f8b494c9f247f40dafd7a80b58b (diff)
downloadvboot-34be8273e0fb80a6654deab650e581b0dc9046a4.tar.gz
Import firmware compiler flags
If passed into Makefile, firmware compiler flags (CC and CFLAGS) will override old values to make sure that the compiled vboot_reference library has calling convention and alike compatible with the firmware. CL:6257018 had caused buildbot failure due to combination of two reasons: First, the Makefile rule for tlcl_generator that uses HOSTCC, which is not the cross-compiler passed to Makefile, but wrongly passes CFLAGS, rather than stuff like HOSTCFLAGS, into HOSTCC. Second, CL:6257018 changed the behavior of Makefile, and so it did not override CFLAGS value passed by emerge-${BOARD}, which is incompatible with HOSTCC. Thus, this CL preserves the previous the behavior of Makefile that always overrides CFLAGS value received from outside world. See also CL:6355014 BUG=None TEST=See below 1. Run emerge-tegra2_seaboard vboot_reference-firmware successfully, and check if vboot.a is compiled with CFLAGS from u-boot-cflags.mk 2. Run emerge and emerge-${BOARD} vboot_reference successfully Review URL: http://codereview.chromium.org/6297017 Change-Id: I4b85079c520efdb7043c012b994817b47ebe831c
-rw-r--r--Makefile20
1 files changed, 15 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 36250fb6..0d29bd50 100644
--- a/Makefile
+++ b/Makefile
@@ -6,16 +6,26 @@ export FIRMWARE_ARCH
export CC ?= gcc
export CXX ?= g++
-ifeq ($(FIRMWARE_ARCH),)
-export CFLAGS = -Wall -Werror -DCHROMEOS_ENVIRONMENT
-else
export CFLAGS = -Wall -Werror
-endif
ifeq (${DEBUG},)
CFLAGS += -O3
else
-CFLAGS += -O0 -g -DVBOOT_DEBUG
+CFLAGS += -O0 -g
+endif
+
+# Override CC and CFLAGS only if FIRMWARE_CONFIG_PATH is not empty, but we
+# wish to preserve -D flags (so move all -D flags after this).
+ifneq (${FIRMWARE_CONFIG_PATH},)
+include ${FIRMWARE_CONFIG_PATH}
+endif
+
+ifeq ($(FIRMWARE_ARCH),)
+CFLAGS += -DCHROMEOS_ENVIRONMENT
+endif
+
+ifneq (${DEBUG},)
+CFLAGS += -DVBOOT_DEBUG
endif
ifeq (${DISABLE_NDEBUG},)