From patchwork Fri May 20 12:14:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bertrand Marquis X-Patchwork-Id: 12856718 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B41DDC433EF for ; Fri, 20 May 2022 12:15:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.333993.558010 (Exim 4.92) (envelope-from ) id 1ns1Wu-0005RH-IG; Fri, 20 May 2022 12:14:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 333993.558010; Fri, 20 May 2022 12:14:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ns1Wu-0005R5-CJ; Fri, 20 May 2022 12:14:52 +0000 Received: by outflank-mailman (input) for mailman id 333993; Fri, 20 May 2022 12:14:50 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ns1Ws-0005Cp-Lk for xen-devel@lists.xenproject.org; Fri, 20 May 2022 12:14:50 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 71b37d81-d836-11ec-bd2c-47488cf2e6aa; Fri, 20 May 2022 14:14:49 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BB8551477; Fri, 20 May 2022 05:14:48 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABFDC3F718; Fri, 20 May 2022 05:14:47 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 71b37d81-d836-11ec-bd2c-47488cf2e6aa From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v2] build: Fix make warning if there is no cppcheck Date: Fri, 20 May 2022 13:14:38 +0100 Message-Id: <20277da971c1050d0464410e24ecff9d5d659990.1653048581.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 If cppcheck is not present, the following warning appears during build: which: no cppcheck in ([...]) /bin/sh: cppcheck: command not found Fix the problem by using shell code inside the cppcheck-version rule to also prevent unneeded call of which when something else than cppcheck is built. Reported-by: Julien Grall Signed-off-by: Bertrand Marquis Acked-by: Jan Beulich --- xen/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index 15388703bc..e8d8ed71bc 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -694,12 +694,14 @@ $(objtree)/%.c.cppcheck: $(srctree)/%.c $(objtree)/include/generated/autoconf.h $(call if_changed,cppcheck_xml) cppcheck-version: -ifeq ($(shell which $(CPPCHECK)),) - $(error Cannot find cppcheck executable: $(CPPCHECK)) -endif -ifeq ($(shell $(CPPCHECK) --version | awk '{print ($$2 < 2.7)}'),1) - $(error Please upgrade your cppcheck to version 2.7 or greater) -endif + @if ! which $(CPPCHECK) > /dev/null 2>&1; then \ + echo "Cannot find cppcheck executable: $(CPPCHECK)"; \ + exit 1; \ + fi + @if [ "$$($(CPPCHECK) --version | awk '{print ($$2 < 2.7)}')" -eq 1 ]; then \ + echo "Please upgrade your cppcheck to version 2.7 or greater"; \ + exit 1; \ + fi # Put this in generated headers this way it is cleaned by include/Makefile $(objtree)/include/generated/compiler-def.h: