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
diff --git a/Makefile b/Makefile
index 36250fb..0d29bd5 100644
--- a/Makefile
+++ b/Makefile
@@ -6,16 +6,26 @@
 
 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},)