From patchwork Fri Sep 13 17:25:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 274822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6832C2C008F for ; Sat, 14 Sep 2013 03:43:59 +1000 (EST) Received: from localhost ([::1]:50397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKXPQ-0006pN-5s for incoming@patchwork.ozlabs.org; Fri, 13 Sep 2013 13:43:56 -0400 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 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VKX7y-0002xd-IU; Fri, 13 Sep 2013 18:25:54 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 13 Sep 2013 18:25:52 +0100 Message-Id: <1379093154-11348-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 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 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Paolo Bonzini , =?UTF-8?q?=C3=81kos=20Kov=C3=A1cs?= , Anthony Liguori , patches@linaro.org Subject: [Qemu-devel] [PATCH v2 2/4] rules.mak: New string testing functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.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