From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKXP8-0006p1-E8 for qemu-devel@nongnu.org; Fri, 13 Sep 2013 13:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKXP7-0004bH-MS for qemu-devel@nongnu.org; Fri, 13 Sep 2013 13:43:38 -0400 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:43999 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKXP7-0004b3-FO for qemu-devel@nongnu.org; Fri, 13 Sep 2013 13:43:37 -0400 From: Peter Maydell Date: Fri, 13 Sep 2013 18:25:52 +0100 Message-Id: <1379093154-11348-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1379093154-11348-1-git-send-email-peter.maydell@linaro.org> References: <1379093154-11348-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v2 2/4] rules.mak: New string testing functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?=C3=81kos=20Kov=C3=A1cs?= , Anthony Liguori , patches@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 . Signed-off-by: Peter Maydell --- 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