summaryrefslogtreecommitdiff
path: root/Makefile.toolchain
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2019-07-01 16:52:09 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-21 18:51:55 +0000
commit0393557c98a015318c13452650b657ac173ecd07 (patch)
tree7f8b78ea656ec7bf29182e615a4a0dd6125c10e2 /Makefile.toolchain
parentfb08e0bf9dd370fc4ae1ce75dad890aa14be668e (diff)
downloadchrome-ec-0393557c98a015318c13452650b657ac173ecd07.tar.gz
ec_commands: Make importing ec_commands.h easier for foreign projects
There are many projects (e.g., kernel, coreboot, flashrom, mosys) having their own copy of the ec_commands.h header file. To reduce the effort of synchronization, this file should be maintained so that it can be copied and included without modification whenever possible. Currently ec_commands.h includes compile_time_macros.h only if __KERNEL__ is not defined. However, there are many macros defined in the latter file (e.g., ARRAY_SIZE) that are already defined in other projects, leading to a redefinition error. To resolve this issue, ec_commands.h is modified in this CL so that compile_time_macros.h is only included when inside the Chromium EC repository, which is controlled by the macro CHROMIUM_EC. Option '-DCHROMIUM_EC' is also added to CPPFLAGS to avoid redefinition error of macro 'BUILD_ASSERT'. BUG=b:109900671,b:118654976,chromium:984623 BRANCH=none TEST=make buildall -j Cq-Depend:chromium:1760656 Change-Id: I38c77f0233ff5962b6f90f25ba96802d05e706d7 Signed-off-by: Yu-Ping Wu <yupingso@chromium.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1535086 Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r--Makefile.toolchain8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain
index 1a3e47e010..f1a5a4d3a2 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -100,6 +100,7 @@ CPPFLAGS+=-Ibuiltin/
else
CPPFLAGS+=-Og
endif
+CPPFLAGS+= -DCHROMIUM_EC=$(EMPTY)
CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(COMMON_WARN) $(CFLAGS_y)
CFLAGS+= -ffunction-sections -fshort-wchar
CFLAGS+= -fno-delete-null-pointer-checks
@@ -107,7 +108,6 @@ ifneq ($(cc-name),clang)
CFLAGS+= -ffat-lto-objects
CFLAGS+= -fconserve-stack
endif
-CFLAGS+= -DCHROMIUM_EC=$(EMPTY)
CXXFLAGS+=-DPROTOBUF_INLINE_NOT_IN_HEADERS=0
FTDIVERSION:=$(shell $(PKG_CONFIG) --modversion libftdi1 2>/dev/null)
@@ -130,11 +130,13 @@ LIBPROTOBUF_MUTATOR_LDLIBS:=$(shell $(PKG_CONFIG) --libs libprotobuf-mutator) \
${LIBPROTOBUF_LDLIBS}
endif
-BUILD_CFLAGS = $(LIBFTDIUSB_CFLAGS) $(BUILD_CPPFLAGS) -O3 $(CFLAGS_DEBUG)
-BUILD_CFLAGS += $(CFLAGS_WARN)
+BUILD_CFLAGS=$(LIBFTDIUSB_CFLAGS) $(BUILD_CPPFLAGS) -O3 $(CFLAGS_DEBUG)
+BUILD_CFLAGS+=$(CFLAGS_WARN)
+BUILD_CFLAGS+=-DCHROMIUM_EC=$(EMPTY)
HOST_CFLAGS=$(HOST_CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN) \
-DHOST_TOOLS_BUILD=$(EMPTY)
HOST_CFLAGS+=$(LIBFTDIUSB_CFLAGS)
+HOST_CFLAGS+=-DCHROMIUM_EC=$(EMPTY)
ifneq (${SYSROOT},)
LDFLAGS_EXTRA+=--sysroot=${SYSROOT}
endif