path: root/support
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2019-04-15 21:47:27 +0200
committerGravatar Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>2019-04-15 23:24:13 +0200
commit9bde598ced805f1f4c437ca53dcb3313e9ea57f2 (patch)
treee59fd91c54c25d61c24e2aaf11c1d7b47220bd05 /support
parent5a0d6813948fea2cdb88a2e35984520eec856dec (diff)
infra/utils: add helper to generate comma-separated lists
Add a helper macro that, from a space-separated list of items, returns a comma-separated list of the quoted items. This will be useful when we need to generate lists in JSON, later... Code suggested by Thomas P. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Diffstat (limited to 'support')
1 files changed, 4 insertions, 0 deletions
diff --git a/support/misc/utils.mk b/support/misc/utils.mk
index c44319338e..b422c67d76 100644
--- a/support/misc/utils.mk
+++ b/support/misc/utils.mk
@@ -70,6 +70,10 @@ finddirclauses = $(call notfirstword,$(patsubst %,-o -path '$(1)/%',$(2)))
# notfirstword(wordlist): returns all but the first word in wordlist
notfirstword = $(wordlist 2,$(words $(1)),$(1))
+# build a comma-separated list of quoted items, from a space-separated
+# list of unquoted items: a b c d --> "a", "b", "c", "d"
+make-comma-list = $(subst $(space),$(comma)$(space),$(patsubst %,"%",$(strip $(1))))
# Needed for the foreach loops to loop over the list of hooks, so that
# each hook call is properly separated by a newline.
define sep