diff mbox series

[1/3] kbuild: Add wilddt function

Message ID 7fe1bbe77ddec38678a60e75512dabdd7e97ab1c.1546888138.git.leonard.crestez@nxp.com (mailing list archive)
State Deferred
Headers show
Series kbuild: Add wilddt function instead of listing dtbs | expand

Commit Message

Leonard Crestez Jan. 7, 2019, 7:31 p.m. UTC
Many SOCs have very simple naming conventions for all boards using a
certain chip and long dtb lists can be collapsed using wildcards.

Since this applied to many architectures add a wilddt function to
Kbuild.include. Example usage:

dtb-$CONFIG_SOC_ABC123 += $(call wilddt,abc123-*)

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 scripts/Kbuild.include | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 46bf1a073f5d..6b8c0cca07c1 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -197,10 +197,16 @@  clean := -f $(srctree)/scripts/Makefile.clean obj
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj=
 # Usage:
 # $(Q)$(MAKE) $(hdr-inst)=dir
 hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
 
+###
+# Return list of .dtb for all .dts matching $1 in current directory
+#
+# Example usage: dtb-$CONFIG_SOC_ABC123 += $(call wilddt,abc123-*)
+wilddt = $(patsubst $(srctree)/$(src)/%.dts,%.dtb, $(wildcard $(srctree)/$(src)/$(1).dts))
+
 # Prefix -I with $(srctree) if it is not an absolute path.
 # skip if -I has no parameter
 addtree = $(if $(patsubst -I%,%,$(1)), \
 $(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)),$(1))