[Buildroot] [PATCH v2 2/4] package/pkg-utils.mk: add KCONFIG_GET_OPT macro

unixmania at gmail.com unixmania at gmail.com
Thu Feb 27 20:08:13 UTC 2020


From: Carlos Santos <unixmania at gmail.com>

Given a config name and a file list, returns the config value if it is
set in one of the files, otherwise returns an empty string.

Files are searched in the given order and the last value found prevails
over the other ones.

Signed-off-by: Carlos Santos <unixmania at gmail.com>
---
 package/pkg-utils.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index d324934dba..6f9693e81a 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -16,6 +16,10 @@ define KCONFIG_ENABLE_OPT # (option, file)
 	echo '$(1)=y' >> $(2)
 endef
 
+define KCONFIG_GET_OPT # (option, files)
+$(shell $(SED_QUIET) '/^\<$(1)\>=/h;$${x;s/$(1)=//p;}' $(2) 2> /dev/null)
+endef
+
 define KCONFIG_SET_OPT # (option, value, file)
 	$(SED) "/\\<$(1)\\>/d" $(3)
 	echo '$(1)=$(2)' >> $(3)
-- 
2.18.2



More information about the buildroot mailing list