summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--common/build.mk7
2 files changed, 11 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index feb72fcfed..0df7553f22 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,14 @@ include Makefile.toolchain
.PHONY: all
all:
+# Returns the opposite of a configuration variable
+# y ->
+# ro -> rw
+# rw -> ro
+# -> y
+# usage: common-$(call not_cfg,$(CONFIG_FOO))+=bar.o
+not_cfg = $(subst ro rw,y,$(filter-out $(1:y=ro rw),ro rw))
+
# The board makefile sets $CHIP and the chip makefile sets $CORE.
# Include those now, since they must be defined for _flag_cfg below.
include $(BDIR)/build.mk
diff --git a/common/build.mk b/common/build.mk
index 7b70378541..1adbaafb92 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -134,10 +134,9 @@ common-$(HAS_TASK_LIGHTBAR)+=lb_common.o lightbar.o
common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o
common-$(HAS_TASK_TPM)+=tpm_registers.o
-ifeq ($(CONFIG_MALLOC),y)
-common-$(CONFIG_COMMON_RUNTIME)+=shmalloc.o
-else
-common-$(CONFIG_COMMON_RUNTIME)+=shared_mem.o
+ifneq ($(CONFIG_COMMON_RUNTIME),)
+common-$(CONFIG_MALLOC)+=shmalloc.o
+common-$(call not_cfg,$(CONFIG_MALLOC))+=shared_mem.o
endif
ifeq ($(CTS_MODULE),)