From patchwork Mon Aug 4 18:37:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 4673061 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D14739F375 for ; Mon, 4 Aug 2014 18:37:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2D432013D for ; Mon, 4 Aug 2014 18:37:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16070200E8 for ; Mon, 4 Aug 2014 18:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752968AbaHDShf (ORCPT ); Mon, 4 Aug 2014 14:37:35 -0400 Received: from mdfmta009.mxout.tbr.inty.net ([91.221.168.50]:39253 "EHLO smtp.demon.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752156AbaHDShe (ORCPT ); Mon, 4 Aug 2014 14:37:34 -0400 Received: from mdfmta009.tbr.inty.net (unknown [127.0.0.1]) by mdfmta009.tbr.inty.net (Postfix) with ESMTP id 32082384082; Mon, 4 Aug 2014 17:59:21 +0100 (BST) Received: from mdfmta009.tbr.inty.net (unknown [127.0.0.1]) by mdfmta009.tbr.inty.net (Postfix) with ESMTP id 01A88384081; Mon, 4 Aug 2014 17:59:21 +0100 (BST) Received: from [192.168.254.10] (unknown [80.176.147.220]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mdfmta009.tbr.inty.net (Postfix) with ESMTP; Mon, 4 Aug 2014 17:59:20 +0100 (BST) Message-ID: <53DFD2EB.3090204@ramsay1.demon.co.uk> Date: Mon, 04 Aug 2014 19:37:31 +0100 From: Ramsay Jones User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Christopher Li CC: Sparse Mailing-list Subject: [PATCH 05/10] Makefile: suppress error message from shell X-MDF-HostID: 4 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In particular, on systems which do not have 'llvm-config' installed, every invocation of make issues the following messages: /bin/sh: llvm-config: command not found make: llvm-config: Command not found A simple solution would be to suppress these messages by redirecting stderr to the bit-bucket within the definitions of HAVE_LLVM_VERSION and LLVM_VERSION. As an alternative, however, we move the definition of LLVM_VERSION down the file within the HAVE_LLVM conditional, which ensures that the 'llvm-config' command exists. In addition, the HAVE_LLVM_VERSION variable is replaced with an equivalent conditional expression. Signed-off-by: Ramsay Jones --- Makefile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f453ded..1795905 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,6 @@ HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \ HAVE_GTK2:=$(shell pkg-config --exists gtk+-2.0 2>/dev/null && echo 'yes') LLVM_CONFIG:=llvm-config HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes') -HAVE_LLVM_VERSION:=$(shell $(LLVM_CONFIG) --version | grep "^[3-9].*" >/dev/null 2>&1 && echo yes) -LLVM_VERSION:=$(shell $(LLVM_CONFIG) --version) GCC_BASE = $(shell $(CC) --print-file-name=) BASIC_CFLAGS = -DGCC_BASE=\"$(GCC_BASE)\" @@ -76,13 +74,9 @@ else $(warning Your system does not have libgtk2, disabling test-inspect) endif -ifneq ($(HAVE_LLVM),yes) -$(warning Your system does not have llvm, disabling sparse-llvm) -else -ifneq ($(HAVE_LLVM_VERSION),yes) -$(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.) -HAVE_LLVM=no -else +ifeq ($(HAVE_LLVM),yes) +LLVM_VERSION:=$(shell $(LLVM_CONFIG) --version) +ifeq ($(shell expr "$(LLVM_VERSION)" : '[3-9]\.'),2) LLVM_PROGS := sparse-llvm $(LLVM_PROGS): LD := g++ LLVM_LDFLAGS := $(shell $(LLVM_CONFIG) --ldflags) @@ -92,7 +86,11 @@ PROGRAMS += $(LLVM_PROGS) INST_PROGRAMS += sparse-llvm sparsec sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS) sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS) $(LLVM_LDFLAGS) +else +$(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.) endif +else +$(warning Your system does not have llvm, disabling sparse-llvm) endif LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \