qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 04/11] rules.mak: Add startwith() rule


From: Philippe Mathieu-Daudé
Subject: [PATCH v4 04/11] rules.mak: Add startwith() rule
Date: Fri, 22 May 2020 18:37:52 +0200

Add a rule to test if a string starts with a substring.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 rules.mak | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rules.mak b/rules.mak
index 694865b63e..e39bee93d5 100644
--- a/rules.mak
+++ b/rules.mak
@@ -191,6 +191,13 @@ ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n)
 isempty = $(if $1,n,y)
 notempty = $(if $1,y,n)
 
+# startwith
+# Usage: $(call startwith, startstr, fullstr)
+#
+# This macro returns a string (TRUE) when @fullstr starts with
+# @startstr, else returns the empty string (FALSE)
+startwith = $(findstring :$(strip $1),:$(strip $2))
+
 # Generate files with tracetool
 TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
 
-- 
2.21.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]