From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWpc5-0008Ut-HG for qemu-devel@nongnu.org; Thu, 17 Oct 2013 11:35:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWpbz-0004bI-P6 for qemu-devel@nongnu.org; Thu, 17 Oct 2013 11:35:49 -0400 Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:38595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWpbz-0004a4-I7 for qemu-devel@nongnu.org; Thu, 17 Oct 2013 11:35:43 -0400 Received: by mail-ee0-f44.google.com with SMTP id b47so1177026eek.3 for ; Thu, 17 Oct 2013 08:35:42 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 17 Oct 2013 17:35:30 +0200 Message-Id: <1382024133-15764-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1382024133-15764-1-git-send-email-pbonzini@redhat.com> References: <1382024133-15764-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 2/5] rules.mak: New string testing functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell From: Peter Maydell 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 Signed-off-by: Paolo Bonzini --- 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.8.3.1