From patchwork Fri Sep 13 17:25:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 20291 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 535BC266EA for ; Fri, 13 Sep 2013 17:25:59 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id db12sf1609274veb.2 for ; Fri, 13 Sep 2013 10:25:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=mFBlzfpJpBZjB9H/Kueh0sDhsx8mfDyDoMhhyUDdzEw=; b=Ltrci8+LiC78VseSbp4kv895mV+NmdU5xBsw334NEmTyikuvUEeRaU7lvovJAHeYzf Y8xWFlmE+Egr9a3iM2d9IsPDyKvLjke89HA2wiFE9+gXEPAJARTOgeNuBvcamY26W+6n QRWyIce9DZTANrXEPQNC818JP2uEXFMMovzlZU6BSRNDPcCgt+AdLH4wApmyuNEj/axe 0YpI7/aTP+uYgc55+BxDMbV09/OCNpsbNrWp1/hc+70C84y3sNwXt/RjH8qerALWYQ+F /zXZZA84646LjubdXPF312/2+D7mL28o7t9Gv78nb/7CGhPkQTDx9uE2/bN4vJlaPM2o 1Nbw== X-Gm-Message-State: ALoCoQm9tzOp3d3NZkrZDg/1xAQYlZlI98kcgEBfMG1e9EqjcWgx7fV+ZQpX72Jjparo39pZECFG X-Received: by 10.236.19.225 with SMTP id n61mr5371036yhn.8.1379093159406; Fri, 13 Sep 2013 10:25:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.144 with SMTP id u16ls1208605qef.84.gmail; Fri, 13 Sep 2013 10:25:59 -0700 (PDT) X-Received: by 10.221.27.73 with SMTP id rp9mr1741826vcb.29.1379093159165; Fri, 13 Sep 2013 10:25:59 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id v6si3444216vet.38.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 10:25:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so1216181veb.2 for ; Fri, 13 Sep 2013 10:25:59 -0700 (PDT) X-Received: by 10.52.108.230 with SMTP id hn6mr2391935vdb.28.1379093159064; Fri, 13 Sep 2013 10:25:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp91964vcz; Fri, 13 Sep 2013 10:25:58 -0700 (PDT) X-Received: by 10.194.48.74 with SMTP id j10mr2648320wjn.41.1379093157060; Fri, 13 Sep 2013 10:25:57 -0700 (PDT) Received: from mnementh.archaic.org.uk (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]) by mx.google.com with ESMTPS id fp6si1677072wib.60.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 10:25:57 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VKX7y-0002xZ-HO; Fri, 13 Sep 2013 18:25:54 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?=C3=81kos=20Kov=C3=A1cs?= , Anthony Liguori , Paolo Bonzini Subject: [PATCH v2 1/4] rules.mak: New logical functions for handling y/n values Date: Fri, 13 Sep 2013 18:25:51 +0100 Message-Id: <1379093154-11348-2-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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add new logical functions for handling y/n values like those we use in CONFIG_FOO variables: lnot : logical NOT land : logical AND lor : logical OR lxor : logical XOR leqv : logical equality, inverse of lxor lif : like Make's $(if) but with an eq-like test Based on an idea by Ákos Kovács . Signed-off-by: Peter Maydell --- rules.mak | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rules.mak b/rules.mak index abc2e84..65a1b96 100644 --- a/rules.mak +++ b/rules.mak @@ -89,6 +89,23 @@ find-in-path = $(if $(find-string /, $1), \ $(wildcard $1), \ $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH))))) +# Logical functions (for operating on y/n values like CONFIG_FOO vars) +# Inputs to these must be either "y" (true) or "n" or "" (both false) +# Output is always either "y" or "n". +# Usage: $(call land,$(CONFIG_FOO),$(CONFIG_BAR)) +# Logical NOT +lnot = $(if $(subst n,,$1),n,y) +# Logical AND +land = $(if $(findstring yy,$1$2),y,n) +# Logical OR +lor = $(if $(findstring y,$1$2),y,n) +# Logical XOR (note that this is the inverse of leqv) +lxor = $(if $(filter $(call lnot,$1),$(call lnot,$2)),n,y) +# Logical equivalence (note that leqv "","n" is true) +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) + # Generate files with tracetool TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py