aboutsummaryrefslogtreecommitdiff
path: root/mk/checkconf.mk
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2015-10-28 13:56:57 +0100
committerJerome Forissier <jerome.forissier@linaro.org>2015-10-28 15:06:24 +0100
commit10b7925c329b8d1838525107d305a4192d9e81df (patch)
treea709d855c18284bcfe79c99fa0fbf0869e8fc23c /mk/checkconf.mk
parent21b3ff1d09e7559a99ce3fd4265328782191cb64 (diff)
mk/checkconf.mk: Add optional reason text to the 'force' macro
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'mk/checkconf.mk')
-rw-r--r--mk/checkconf.mk12
1 files changed, 8 insertions, 4 deletions
diff --git a/mk/checkconf.mk b/mk/checkconf.mk
index 0c2aad79..65a2391c 100644
--- a/mk/checkconf.mk
+++ b/mk/checkconf.mk
@@ -147,17 +147,21 @@ cfg-enable-all-depends =
) \
)
-# Set a variable and error out if it was previously set to a different value
+# Set a variable or error out if it was previously set to a different value
+# The reason message (3rd parameter) is optional
# Example:
-# $(call force,CFG_FOO,foo)
+# $(call force,CFG_FOO,foo,required by CFG_BAR)
define force
-$(eval $(call _force,$(1),$(2)))
+$(eval $(call _force,$(1),$(2),$(3)))
endef
define _force
ifdef $(1)
ifneq ($($(1)),$(2))
-$$(error $(1) is set to '$($(1))' (from $(origin $(1))) but its value must be '$2')
+ifneq (,$(3))
+_reason := $$(_empty) [$(3)]
+endif
+$$(error $(1) is set to '$($(1))' (from $(origin $(1))) but its value must be '$(2)'$$(_reason))
endif
endif
$(1) := $(2)