Makefile: Enable bitbang_spi based on its dependency list
Change-Id: I2a22667cfe14e4c5816b3bce13de632941690d17
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/55880
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71412
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/Makefile b/Makefile
index 85ef309..754bdac 100644
--- a/Makefile
+++ b/Makefile
@@ -93,6 +93,7 @@
CONFIG_SERPROG \
DEPENDS_ON_BITBANG_SPI := \
+ CONFIG_DEVELOPERBOX_SPI \
CONFIG_INTERNAL \
CONFIG_NICINTEL_SPI \
CONFIG_OGP_SPI \
@@ -140,6 +141,12 @@
$(eval override $(p) := no)))
endef
+define filter_deps
+$(strip $(foreach p,$1, \
+ $(if $(filter $($(p)),yes), \
+ $(p))))
+endef
+
define disable_all
$(foreach p,$1, \
$(eval override $(p) := no))
@@ -459,31 +466,12 @@
endif
# Bitbanging SPI infrastructure, default off unless needed.
-ifeq ($(CONFIG_RAYER_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_PONY_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_INTERNAL), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_OGP_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_DEVELOPERBOX_SPI), yes)
+
+ifneq ($(call filter_deps,$(DEPENDS_ON_BITBANG_SPI)), )
override CONFIG_BITBANG_SPI = yes
else
CONFIG_BITBANG_SPI ?= no
endif
-endif
-endif
-endif
-endif
-endif
###############################################################################
# Handle CONFIG_* variables that depend on others set (and verified) above.