summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-28 08:15:21 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-28 07:06:45 -0700
commit6f38ed23f3d467937f15cf0474b8f323564bcc0d (patch)
tree1e3e0e645638fd176ef184ce80debedf35d646c6
parentcacc1c8ac679b66876cf3e65c58f2bf874498050 (diff)
downloadchrome-ec-6f38ed23f3d467937f15cf0474b8f323564bcc0d.tar.gz
Makefile.toolchain: Switch from cpp to $(CC) -E
Makes it more straightforward to switch to clang preprocessor later on. This requires a few other modifications in the Makefiles (gcc -E does not read from stdin by default, and does not process files that do not end in .c/.h). BRANCH=none BUG=chromium:854924 TEST=make buildall -j TEST=Before and after the change, all ec.bin binaries are identical: git checkout m/master make REAL_SIGNER=dummy buildall -j mv build build-master find build-master -type d | sed -e 's/-master//' | \ xargs -I{} mkdir -p {} find build-master -name ec_version.h | sed -e 's|build-master/||' | \ xargs -I{} cp build-master/{} build/{} git checkout this-cl => comment out .PHONY: $(out)/ec_version.h in Makefiles.rules make REAL_SIGNER=dummy buildall -j find build-master -name ec.bin | sed -e 's|build-master/||' | \ xargs -I{} diff build-master/{} build/{} => No difference Change-Id: If07f033dc7e9a73245499c656562bb906dcd4130 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1117721 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--Makefile10
-rw-r--r--Makefile.rules2
-rw-r--r--Makefile.toolchain2
3 files changed, 7 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 4460c2f045..53d49b0155 100644
--- a/Makefile
+++ b/Makefile
@@ -146,21 +146,21 @@ ifneq "$(CONFIG_COMMON_RUNTIME)" "y"
_irq_list:=$(shell $(CPP) $(CPPFLAGS) -P -Ichip/$(CHIP) -I$(BASEDIR) \
-I$(BDIR) -D"ENABLE_IRQ(x)=EN_IRQ x" \
-imacros chip/$(CHIP)/registers.h \
- $(BDIR)/ec.irqlist | grep "EN_IRQ .*" | cut -c8-)
+ - < $(BDIR)/ec.irqlist | grep "EN_IRQ .*" | cut -c8-)
CPPFLAGS+=$(foreach irq,$(_irq_list),\
-D"irq_$(irq)_handler_optional=irq_$(irq)_handler")
endif
# Compute RW firmware size and offset
_rw_off_str:=$(shell echo "CONFIG_RW_MEM_OFF" | $(CPP) $(CPPFLAGS) -P \
- -Ichip/$(CHIP) -I$(BASEDIR) -I$(BDIR) -imacros include/config.h)
+ -Ichip/$(CHIP) -I$(BASEDIR) -I$(BDIR) -imacros include/config.h -)
_rw_off:=$(shell echo "$$(($(_rw_off_str)))")
_rw_size_str:=$(shell echo "CONFIG_RW_SIZE" | $(CPP) $(CPPFLAGS) -P \
- -Ichip/$(CHIP) -I$(BASEDIR) -I$(BDIR) -imacros include/config.h)
+ -Ichip/$(CHIP) -I$(BASEDIR) -I$(BDIR) -imacros include/config.h -)
_rw_size:=$(shell echo "$$(($(_rw_size_str)))")
_program_memory_base_str:=$(shell echo "CONFIG_PROGRAM_MEMORY_BASE" | \
- $(CPP) $(CPPFLAGS) -P \
- -Ichip/$(CHIP) -I$(BDIR) -I$(BASEDIR) -imacros include/config.h)
+ $(CPP) $(CPPFLAGS) -P \
+ -Ichip/$(CHIP) -I$(BDIR) -I$(BASEDIR) -imacros include/config.h -)
_program_memory_base=$(shell echo "$$(($(_program_memory_base_str)))")
$(eval BASEBOARD_$(UC_BASEBOARD)=y)
diff --git a/Makefile.rules b/Makefile.rules
index 50fe0a017d..9138b35ed9 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -286,7 +286,7 @@ $(foreach b, $(cts_boards), \
)
cov-test-targets=$(foreach t,$(test-list-host),build/host/$(t).info)
-bldversion=$(shell (./util/getversion.sh ; echo VERSION) | $(CPP) -P)
+bldversion=$(shell (./util/getversion.sh ; echo VERSION) | $(CPP) -P -)
# lcov fails when multiple instances run at the same time.
# We need to run them sequentially by using flock
diff --git a/Makefile.toolchain b/Makefile.toolchain
index 37100780d1..093721eede 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -22,7 +22,7 @@ HOST_CROSS_COMPILE:=$(if $(shell which x86_64-pc-linux-gnu-gcc 2>/dev/null),x86_
endif
CC=$(CCACHE) $(CROSS_COMPILE)gcc
-CPP=$(CCACHE) $(CROSS_COMPILE)cpp
+CPP=$(CC) -E
LD=$(CROSS_COMPILE)ld
NM=$(CROSS_COMPILE)nm
OBJCOPY=$(CROSS_COMPILE)objcopy