summaryrefslogtreecommitdiff
path: root/Makefile.toolchain
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2019-05-24 11:18:26 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-06-03 01:11:04 -0700
commit49436b18d2a77b994fe76d8c2f070000e2cdb58a (patch)
tree327729dead0cf855fca17c067d499c66773ebe06 /Makefile.toolchain
parent7ccb50f4352309813cffd98460bd7dcb48d4657f (diff)
downloadchrome-ec-49436b18d2a77b994fe76d8c2f070000e2cdb58a.tar.gz
Makefile: Replace flag -DX with -DX= to be supported by IS_ENABLED().
IS_ENABLED works for an empty-string-defined macro. However, -D options default to define the macro to 1. This CL forces those macros, such as BOARD_* CHIP_*, CORE_*, CHIP_VARIANT_* and CHIP_FAMILIY_*, to be defined as an empty string, so that it can be supported by IS_ENABLED macro. TEST=use if(IS_ENABLED(BOARD_KRANE)) and see compilation success. TEST=compares build directory w/ and w/o this CL, and see the .smap are the same: ls build/*/*/ec.*.smap | sed -e 's|build/||' | \ xargs -I{} diff -u -a build/{} build.new/{} BUG=none BRANCH=None Change-Id: I96e2aa1cb5f3369e5e445a674595a9234f26707a Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1627840 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r--Makefile.toolchain31
1 files changed, 18 insertions, 13 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain
index c7ab5ac106..857f32158d 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -61,34 +61,38 @@ CXXFLAGS_WARN = $(COMMON_WARN)
CFLAGS_DEBUG= -g
CFLAGS_DEBUG+=$(CFLAGS_DEBUG_CHIP)
CFLAGS_INCLUDE=$(foreach i,$(includes),-I$(i) ) -I.
-CFLAGS_TEST=$(if $(TEST_BUILD),-DTEST_BUILD \
+CFLAGS_TEST=$(if $(TEST_BUILD),-DTEST_BUILD=$(EMPTY) \
-DTEST_TASKFILE=$(PROJECT).tasklist,) \
$(if $(CTS_MODULE), $(CFLAGS_CTS)) \
- $(if $(EMU_BUILD),-DEMU_BUILD) \
+ $(if $(EMU_BUILD),-DEMU_BUILD=$(EMPTY)) \
$(if $($(PROJECT)-scale),-DTEST_TIME_SCALE=$($(PROJECT)-scale)) \
- -DTEST_$(PROJECT) -DTEST_$(UC_PROJECT) \
+ -DTEST_$(PROJECT)=$(EMPTY) -DTEST_$(UC_PROJECT)=$(EMPTY) \
$(if $(TEST_ASAN),-fsanitize=address) \
$(if $(TEST_MSAN),-fsanitize=memory) \
$(if $(TEST_UBSAN),$(UBSAN_FLAGS)) \
- $(if $(TEST_FUZZ),-fsanitize=fuzzer-no-link -DTEST_FUZZ)
+ $(if $(TEST_FUZZ),-fsanitize=fuzzer-no-link -DTEST_FUZZ=$(EMPTY))
CFLAGS_COVERAGE=$(if $(TEST_COVERAGE),-fprofile-arcs -ftest-coverage \
- -DTEST_COVERAGE,)
+ -DTEST_COVERAGE=$(EMPTY),)
CFLAGS_DEFINE=-DOUTDIR=$(out)/$(BLD) -DCHIP=$(CHIP) -DBOARD_TASKFILE=$(_tsk_lst_file) \
-DBOARD=$(BOARD) -DCORE=$(CORE) -DPROJECT=$(PROJECT) \
-DCHIP_VARIANT=$(CHIP_VARIANT) -DCHIP_FAMILY=$(CHIP_FAMILY) \
- -DBOARD_$(UC_BOARD) -DCHIP_$(UC_CHIP) -DCORE_$(UC_CORE) \
- -DCHIP_VARIANT_$(UC_CHIP_VARIANT) -DCHIP_FAMILY_$(UC_CHIP_FAMILY) \
- -DFINAL_OUTDIR=$(out) -DPROTOBUF_MIN_PROTOC_VERSION=0 \
+ -DBOARD_$(UC_BOARD)=$(EMPTY) \
+ -DCHIP_$(UC_CHIP)=$(EMPTY) \
+ -DCORE_$(UC_CORE)=$(EMPTY) \
+ -DCHIP_VARIANT_$(UC_CHIP_VARIANT)=$(EMPTY) \
+ -DCHIP_FAMILY_$(UC_CHIP_FAMILY)=$(EMPTY) \
+ -DFINAL_OUTDIR=$(out) \
+ -DPROTOBUF_MIN_PROTOC_VERSION=0 \
$(CFLAGS_BASEBOARD)
CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(CFLAGS_TEST) \
$(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \
- -DSECTION_IS_$(BLD) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD))
+ -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD))
BUILD_CPPFLAGS=$(CFLAGS_DEFINE) -Icore/host $(CFLAGS_INCLUDE) $(CFLAGS_TEST) \
$(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \
- -DSECTION_IS_$(BLD) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD))
+ -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD))
HOST_CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(CFLAGS_TEST) \
$(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \
- -DSECTION_IS_$(BLD) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD))
+ -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD))
ifneq ($(BOARD),host)
CPPFLAGS+=-ffreestanding -fno-builtin -nostdinc -nostdlib
CPPFLAGS+=-Ibuiltin/
@@ -101,7 +105,7 @@ CFLAGS+= -fno-delete-null-pointer-checks
ifneq ($(cc-name),clang)
CFLAGS+= -fconserve-stack
endif
-CFLAGS+= -DCHROMIUM_EC
+CFLAGS+= -DCHROMIUM_EC=$(EMPTY)
CXXFLAGS+=-DPROTOBUF_INLINE_NOT_IN_HEADERS=0
FTDIVERSION:=$(shell $(PKG_CONFIG) --modversion libftdi1 2>/dev/null)
@@ -126,7 +130,8 @@ endif
BUILD_CFLAGS = $(LIBFTDIUSB_CFLAGS) $(BUILD_CPPFLAGS) -O3 $(CFLAGS_DEBUG)
BUILD_CFLAGS += $(CFLAGS_WARN)
-HOST_CFLAGS=$(HOST_CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN) -DHOST_TOOLS_BUILD
+HOST_CFLAGS=$(HOST_CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN) \
+ -DHOST_TOOLS_BUILD=$(EMPTY)
HOST_CFLAGS+=$(LIBFTDIUSB_CFLAGS)
ifneq (${SYSROOT},)
LDFLAGS_EXTRA+=--sysroot=${SYSROOT}