From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Ákos Kovács" <akoskovacs@gmx.com>,
"Anthony Liguori" <anthony@codemonkey.ws>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH v2 2/4] rules.mak: New string testing functions
Date: Fri, 13 Sep 2013 18:25:52 +0100 [thread overview]
Message-ID: <1379093154-11348-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1379093154-11348-1-git-send-email-peter.maydell@linaro.org>
Add new string testing functions which return a y/n result:
eq : are two strings equal (ignoring leading/trailing space)?
ne : are two strings unequal?
isempty : is a string empty?
notempty : is a string non-empty?
Based on an idea by Ákos Kovács <akoskovacs@gmx.com>.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
rules.mak | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/rules.mak b/rules.mak
index 65a1b96..49edb9b 100644
--- a/rules.mak
+++ b/rules.mak
@@ -106,6 +106,17 @@ leqv = $(if $(filter $(call lnot,$1),$(call lnot,$2)),y,n)
# Logical if: like make's $(if) but with an leqv-like test
lif = $(if $(subst n,,$1),$2,$3)
+# String testing functions: inputs to these can be any string;
+# the output is always either "y" or "n". Leading and trailing whitespace
+# is ignored when comparing strings.
+# String equality
+eq = $(if $(subst $2,,$1)$(subst $1,,$2),n,y)
+# String inequality
+ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n)
+# Emptiness/non-emptiness tests:
+isempty = $(if $1,n,y)
+notempty = $(if $1,y,n)
+
# Generate files with tracetool
TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
--
1.7.9.5
next prev parent reply other threads:[~2013-09-13 17:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 17:25 [Qemu-devel] [PATCH v2 0/4] avoid CONFIG_NO_* using rules.mak logic/string fns Peter Maydell
2013-09-13 17:25 ` [Qemu-devel] [PATCH v2 1/4] rules.mak: New logical functions for handling y/n values Peter Maydell
2013-09-13 17:25 ` Peter Maydell [this message]
2013-09-13 17:25 ` [Qemu-devel] [PATCH v2 3/4] Makefile.target: CONFIG_NO_* variables removed Peter Maydell
2013-09-13 17:25 ` [Qemu-devel] [PATCH v2 4/4] default-configs/: CONFIG_GDBSTUB_XML removed Peter Maydell
2013-09-13 20:15 ` [Qemu-devel] [PATCH v2 0/4] avoid CONFIG_NO_* using rules.mak logic/string fns Paolo Bonzini
2013-09-27 3:02 ` Peter Maydell
2013-10-15 14:47 ` Peter Maydell
2013-10-15 14:55 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379093154-11348-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=akoskovacs@gmx.com \
--cc=anthony@codemonkey.ws \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).