aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSimon Glass2021-03-25 21:24:33 +1300
committerTom Rini2021-03-27 09:48:26 -0400
commit13732528516d161ad52e878bdb6b5aec309cf0c0 (patch)
tree1d6a7bc8d12c027134554c8bafdc7d637f091edc /Makefile
parent06467e4652460f619f8be4bb4859e171d35cc258 (diff)
Makefile: Add common code to report deprecation
Add a function which can be called to report a migration problem. This will make it easier to add new migration checks, since the logic and strings are not spread out over 8 lines of code. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 64766e20297..a816ce74fb6 100644
--- a/Makefile
+++ b/Makefile
@@ -1017,6 +1017,33 @@ quiet_cmd_cfgcheck = CFGCHK $2
cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
$(srctree)/scripts/config_whitelist.txt $(srctree)
+# Concat the value of all the CONFIGs (result is 'y' or 'yy', etc. )
+got = $(foreach cfg,$(1),$($(cfg)))
+
+# expected value 'y for each one
+expect = $(foreach cfg,$(1),y)
+
+# Show a deprecation message
+# Args:
+# 1: List of CONFIG_DM_... to migrate to (e.g. "CONFIG_DM_MMC CONFIG_BLK")
+# 2: Name of component (e.g . "Ethernet drivers")
+# 3: Release deadline (e.g. "v202.07")
+# 4: Condition to require before checking (e.g. "$(CONFIG_NET)")
+# Note: Script avoids bash construct, hence the strange double 'if'
+# (patches welcome!)
+define deprecated
+ if [ -n "$(strip $(4))" ]; then if [ "$(got)" != "$(expect)" ]; then \
+ echo >&2 "===================== WARNING ======================"; \
+ echo >&2 "This board does not use $(firstword $(1)) (Driver Model"; \
+ echo >&2 "for $(2)). Please update the board to use"; \
+ echo >&2 "$(firstword $(1)) before the $(3) release. Failure to"; \
+ echo >&2 "update by the deadline may result in board removal."; \
+ echo >&2 "See doc/driver-model/migration.rst for more info."; \
+ echo >&2 "===================================================="; \
+ fi; fi
+
+endef
+
PHONY += inputs
inputs: $(INPUTS-y)