[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 04/11] rules.mak: Add strequal() and startwith() rules
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v6 04/11] rules.mak: Add strequal() and startwith() rules |
Date: |
Fri, 5 Jun 2020 11:32:49 +0200 |
Add a rule to test if two strings are equal,
and another to test if a string starts with a substring.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
rules.mak | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/rules.mak b/rules.mak
index 694865b63e..ccc1c49604 100644
--- a/rules.mak
+++ b/rules.mak
@@ -191,6 +191,20 @@ ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n)
isempty = $(if $1,n,y)
notempty = $(if $1,y,n)
+# strequal
+# Usage: $(call strequal, str1, str2)
+#
+# This macro returns a string (TRUE) when @str1 and @str2
+# are equal, else returns the empty string (FALSE)
+strequal = $(if $(subst $2,,$1)$(subst $1,,$2),,$1)
+
+# 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 :$1,:$2)
+
# Generate files with tracetool
TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
--
2.21.3
- [PATCH v6 00/11] accel: Allow targets to use Kconfig, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 01/11] MAINTAINERS: Fix KVM path expansion glob, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 02/11] MAINTAINERS: Add an 'overall' entry for accelerators, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 03/11] MAINTAINERS: Add an entry for the HAX accelerator, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 04/11] rules.mak: Add strequal() and startwith() rules,
Philippe Mathieu-Daudé <=
- [PATCH v6 05/11] rules.mak: Add base-arch() rule, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 06/11] Makefile: Remove dangerous EOL trailing backslash, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 07/11] Makefile: Write MINIKCONF variables as one entry per line, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 08/11] accel/Kconfig: Extract accel selectors into their own config, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v6 09/11] accel/Kconfig: Add the TCG selector, Philippe Mathieu-Daudé, 2020/06/05