summaryrefslogtreecommitdiff
path: root/Makefile.rules
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.rules
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.rules')
-rw-r--r--Makefile.rules18
1 files changed, 9 insertions, 9 deletions
diff --git a/Makefile.rules b/Makefile.rules
index a86ac62869..8a894e4542 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -55,7 +55,7 @@ cmd_libec = $(LD) -r $^ -o $@.1.o && \
$(OBJCOPY) --localize-hidden $@.1.o $@.2.o && \
$(AR) scr $@ $@.2.o
cmd_lds = $(CPP) -P -C -MMD -MF $@.d -MT $@ $(CPPFLAGS) $< -o $@
-cmd_lds_b = $(cmd_lds) -DRW_B_LDS
+cmd_lds_b = $(cmd_lds) -DRW_B_LDS=$(EMPTY)
# Allow obj_to_bin to be overridden by board or chip specific commands
cmd_obj_to_bin ?= $(OBJCOPY) --gap-fill=0xff -O binary $^ $(out)/$*.bin.tmp
cmd_flat_to_obj = $(CC) -Wl,-T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \
@@ -110,8 +110,8 @@ cmd_sharedlib_elf = $(CC) $(libsharedobjs_deps) \
-o $(out)/$(SHOBJLIB)/$(SHOBJLIB).elf \
-Wl,-Map,$(out)/$(SHOBJLIB)/$(SHOBJLIB).map
cmd_c_to_taskinfo = $(BUILDCC) \
- $(filter-out -DSECTION_IS_$(BLD),$(BUILD_CFLAGS)) -DSECTION_IS_$(3) \
- -MMD -MF $@.d -c $< -flto -o $@
+ $(filter-out -DSECTION_IS_$(BLD)=$(EMPTY),$(BUILD_CFLAGS)) \
+ -DSECTION_IS_$(3)=$(EMPTY) -MMD -MF $@.d -c $< -flto -o $@
cmd_link_taskinfo = $(BUILDCC) $(BUILD_CFLAGS) --shared -fPIC $^ \
$(BUILD_LDFLAGS) -flto -o $@
cmd_proto_to_cxx = $(PROTOC) -I. --cpp_out=$(out)/gen $^
@@ -504,7 +504,7 @@ $(out)/gen/%.pb.cc:%.proto
$(out)/gen/%.pb.h:%.proto
$(call quiet,proto_to_cxx,PROTOC )
-$(out)/$(SHOBJLIB)/%.o: override LATE_CFLAGS_DEFINE:=-DSHAREDLIB_IMAGE
+$(out)/$(SHOBJLIB)/%.o: override LATE_CFLAGS_DEFINE:=-DSHAREDLIB_IMAGE=$(EMPTY)
$(out)/$(SHOBJLIB)/%.o:%.c
$(call quiet,c_to_o,CC )
@@ -571,7 +571,7 @@ $(npcx-monitor-fw-bin):
-@ $(OBJCOPY) -O binary $(out)/$(npcx-monitor-fw).elf $@
$(out)/$(npcx-monitor-hdr)_ro.o:$(npcx-monitor-hdr).c
- -@ $(CC) $(CFLAGS) -D SECTION_IS_RO -MMD -c $(npcx-monitor-hdr).c -o $@
+ -@ $(CC) $(CFLAGS) -DSECTION_IS_RO=$(EMPTY) -MMD -c $(npcx-monitor-hdr).c -o $@
$(npcx-monitor-hdr-ro-bin):$(out)/$(npcx-monitor-hdr)_ro.o
$(if $(V),,@echo ' EXTBIN ' $(subst $(out)/,,$@) ; )
@@ -627,14 +627,14 @@ print-configs:
@echo "----------------------------------------------------------------"
@echo "| RO Config: |"
@echo "----------------------------------------------------------------"
- @$(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) \
- -I$(BASEDIR) -I$(BDIR) -DSECTION_IS_RO include/config.h | \
+ @$(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) -I$(BASEDIR) -I$(BDIR) \
+ -DSECTION_IS_RO=$(EMPTY) include/config.h | \
grep "#define CONFIG_" | cut -c9- | sort
@echo "----------------------------------------------------------------"
@echo "| RW Config: |"
@echo "----------------------------------------------------------------"
- @$(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) \
- -I$(BASEDIR) -I$(BDIR) -DSECTION_IS_RW include/config.h | \
+ @$(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) -I$(BASEDIR) -I$(BDIR) \
+ -DSECTION_IS_RW=$(EMPTY) include/config.h | \
grep "#define CONFIG_" | cut -c9- | sort
.PHONY: print-chip-variant