All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Christopher Li <sparse@chrisli.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: [PATCH 05/10] Makefile: suppress error message from shell
Date: Mon, 04 Aug 2014 19:37:31 +0100	[thread overview]
Message-ID: <53DFD2EB.3090204@ramsay1.demon.co.uk> (raw)


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 <ramsay@ramsay1.demon.co.uk>
---
 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 \
-- 
2.0.0

                 reply	other threads:[~2014-08-04 18:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DFD2EB.3090204@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.