From patchwork Fri Sep 13 14:19:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 20284 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 944C7202E6 for ; Fri, 13 Sep 2013 15:19:04 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf1426895veb.3 for ; Fri, 13 Sep 2013 08:19:03 -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=bd2WSO+HoYh7iUbLYc6ueqwRontbsgbNzBvsjASNyog=; b=VQfwOMCxxrI5fP3SRsZuyy1M0cM8LcMJaXlyu8nHQjxvZWgnPOO/v2hWIyLfUJpTUo qFEu9+2ouc9ivyAPE/uG3dS4zqSaMqFH4uqoj/KKobHdeQqLJ/QneNcLkEYT2l0y31Be i5rMm5eu7c73kyJLBm0/3ufvh85rteORx1XY1rKxI+rG0i4M2P5Kr4ldodegy+voBulM 3kIgleopEmJqYO5m9ZH4Ym4+xCTKV54gv7eQJh8T3cqxwTb3oiKFN4dlMD6GtRNPaBXF Sm7wEw1r3rZ920pTs2515nUS3BiN3hXXfVo3spAlwUGoaI67Rvfk4h1JOPd5UWa2JYnC wujQ== X-Gm-Message-State: ALoCoQkzYXLWfhcZ5F+bFdRB21ydx8HGn68EgJTe8f9tmm2VJl8VLMt8QhHKVbNkWVjdn/tuO6Wu X-Received: by 10.58.94.103 with SMTP id db7mr134371veb.40.1379081984897; Fri, 13 Sep 2013 07:19:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.177 with SMTP id gf17ls1135021qeb.4.gmail; Fri, 13 Sep 2013 07:19:44 -0700 (PDT) X-Received: by 10.58.187.47 with SMTP id fp15mr7279580vec.22.1379081984686; Fri, 13 Sep 2013 07:19:44 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id sc5si3202303vdc.22.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 07:19:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id q14so957453vbe.41 for ; Fri, 13 Sep 2013 07:19:44 -0700 (PDT) X-Received: by 10.58.152.3 with SMTP id uu3mr12171311veb.16.1379081984539; Fri, 13 Sep 2013 07:19:44 -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 u4csp83194vcz; Fri, 13 Sep 2013 07:19:44 -0700 (PDT) X-Received: by 10.14.182.137 with SMTP id o9mr3346460eem.59.1379081982697; Fri, 13 Sep 2013 07:19:42 -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 x43si4100823eep.10.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 07:19:42 -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 1VKUDj-0002ux-Hj; Fri, 13 Sep 2013 15:19:39 +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 1/3] rules.mak: New logical functions for handling y/n values Date: Fri, 13 Sep 2013 15:19:37 +0100 Message-Id: <1379081979-11186-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379081979-11186-1-git-send-email-peter.maydell@linaro.org> References: <1379081979-11186-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.212.54 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 eq : equality ne : non-equality lif : like Make's $(if) but with an eq-like test and a couple of utility functions: isempty : true if argument is empty notempty : true if argument is not empty Based on an idea by Ákos Kovács . Signed-off-by: Peter Maydell --- rules.mak | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rules.mak b/rules.mak index abc2e84..ccbf0e3 100644 --- a/rules.mak +++ b/rules.mak @@ -89,6 +89,24 @@ 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) +# Comparison: note that "n" is eq to "". +eq = $(if $(filter $(call lnot,$1),$(call lnot,$2)),y,n) +ne = $(if $(filter $(call lnot,$1),$(call lnot,$2)),n,y) + +# Returns "y" or "n" depending on whether input argument is the empty string +isempty = $(if $1,n,y) +notempty = $(if $1,y,n) + # Generate files with tracetool TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py