summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2017-04-17 11:32:12 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-04-25 05:52:34 -0700
commit896409ef79b1d1c1c25bb8e410474b43a15238a5 (patch)
tree1aad179ea491de4252a5eb4584f91a964d5163d0 /Makefile
parent579a6b00e5b4f31bf3dbefd82aa19fb52b6905bb (diff)
downloadchrome-ec-896409ef79b1d1c1c25bb8e410474b43a15238a5.tar.gz
Makefile: Allow different task list for RO and RW
This adds new macros for tasks (_RO and _RW), which allows to enable a task only for RO or RW section. We also create a new task_filter.h include file, that helps pre-filter those tasks, and can be used either from Makefile, or included from task_id.h. BRANCH=none BUG=b:35582031 TEST=make buildall -j; make savesizes Apply this CL make buildall -j; make newsizes => No size change Change-Id: I472bc6d4ab250a0a0e1fa6aeb4b748ba6968bedf Reviewed-on: https://chromium-review.googlesource.com/479491 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Nick Sanders <nsanders@google.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile55
1 files changed, 31 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 385998ed61..2a93daba29 100644
--- a/Makefile
+++ b/Makefile
@@ -68,41 +68,48 @@ includes+=cts/$(CTS_MODULE) cts
endif
ifeq "$(TEST_BUILD)" "y"
_tsk_lst_file:=ec.tasklist
- _tsk_lst:=$(shell echo "CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST" | \
- $(CPP) -P -I$(BDIR) -DBOARD_$(UC_BOARD) -Itest \
- -D"TASK_NOTEST(n, r, d, s)=" -D"TASK_ALWAYS(n, r, d, s)=n" \
- -D"TASK_TEST(n, r, d, s)=n" -imacros $(_tsk_lst_file) \
- -imacros $(PROJECT).tasklist)
+ _tsk_lst_flags:=-Itest -DTEST_BUILD -imacros $(PROJECT).tasklist
else ifdef CTS_MODULE
_tsk_lst_file:=ec.tasklist
- _tsk_lst:=$(shell echo "CONFIG_TASK_LIST CONFIG_CTS_TASK_LIST" | \
- $(CPP) -P -I cts/$(CTS_MODULE) -Icts -I$(BDIR) \
- -DBOARD_$(UC_BOARD) \
- -D"TASK_NOTEST(n, r, d, s)=n" \
- -D"TASK_ALWAYS(n, r, d, s)=n" \
- -imacros $(_tsk_lst_file) \
- -imacros cts.tasklist)
+ _tsk_lst_flags:=-I cts/$(CTS_MODULE) -Icts -DCTS_MODULE=$(CTS_MODULE) \
+ -imacros cts.tasklist
else
_tsk_lst_file:=$(PROJECT).tasklist
- _tsk_lst:=$(shell echo "CONFIG_TASK_LIST" | $(CPP) -P \
- -I$(BDIR) -DBOARD_$(UC_BOARD) \
- -D"TASK_NOTEST(n, r, d, s)=n" \
- -D"TASK_ALWAYS(n, r, d, s)=n" -imacros $(_tsk_lst_file))
+ _tsk_lst_flags:=
endif
-_tsk_cfg:=$(foreach t,$(_tsk_lst) ,HAS_TASK_$(t))
+_tsk_lst_flags+=-I$(BDIR) -DBOARD_$(UC_BOARD) -D_MAKEFILE \
+ -imacros $(_tsk_lst_file)
+
+_tsk_lst_ro:=$(shell $(CPP) -P -DSECTION_IS_RO \
+ $(_tsk_lst_flags) include/task_filter.h)
+_tsk_lst_rw:=$(shell $(CPP) -P -DSECTION_IS_RW \
+ $(_tsk_lst_flags) include/task_filter.h)
+
+_tsk_cfg_ro:=$(foreach t,$(_tsk_lst_ro) ,HAS_TASK_$(t))
+_tsk_cfg_rw:=$(foreach t,$(_tsk_lst_rw) ,HAS_TASK_$(t))
+
+_tsk_cfg:= $(filter $(_tsk_cfg_ro), $(_tsk_cfg_rw))
+_tsk_cfg_ro:= $(filter-out $(_tsk_cfg), $(_tsk_cfg_ro))
+_tsk_cfg_rw:= $(filter-out $(_tsk_cfg), $(_tsk_cfg_rw))
+
+CPPFLAGS_RO+=$(foreach t,$(_tsk_cfg_ro),-D$(t))
+CPPFLAGS_RW+=$(foreach t,$(_tsk_cfg_rw),-D$(t))
CPPFLAGS+=$(foreach t,$(_tsk_cfg),-D$(t))
-_flag_cfg_ro:=$(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) -I$(BDIR) \
- -DSECTION_IS_RO include/config.h | grep -o "\#define CONFIG_[A-Z0-9_]*" | \
- cut -c9- | sort)
-_flag_cfg_rw:=$(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) -I$(BDIR) \
- -DSECTION_IS_RW include/config.h | grep -o "\#define CONFIG_[A-Z0-9_]*" | \
- cut -c9- | sort)
+
+_flag_cfg_ro:=$(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) \
+ -I$(BDIR) -DSECTION_IS_RO include/config.h | \
+ grep -o "\#define CONFIG_[A-Z0-9_]*" | cut -c9- | sort)
+_flag_cfg_rw:=$(_tsk_cfg_rw) $(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) \
+ -I$(BDIR) -DSECTION_IS_RW include/config.h | \
+ grep -o "\#define CONFIG_[A-Z0-9_]*" | cut -c9- | sort)
+
_flag_cfg:= $(filter $(_flag_cfg_ro), $(_flag_cfg_rw))
_flag_cfg_ro:= $(filter-out $(_flag_cfg), $(_flag_cfg_ro))
_flag_cfg_rw:= $(filter-out $(_flag_cfg), $(_flag_cfg_rw))
-$(foreach c,$(_flag_cfg_rw),$(eval $(c)=rw))
+$(foreach c,$(_tsk_cfg_rw) $(_flag_cfg_rw),$(eval $(c)=rw))
+$(foreach c,$(_tsk_cfg_ro) $(_flag_cfg_ro),$(eval $(c)=ro))
$(foreach c,$(_tsk_cfg) $(_flag_cfg),$(eval $(c)=y))
ifneq "$(CONFIG_COMMON_RUNTIME)" "y"