Re: [PATCH] sparse, llvm: Don't fail the build if LLVM is too old

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First of all, I want to make the sparse-llvm works on release version as well,
if that is not too much trouble.


On Thu, Nov 24, 2011 at 11:06 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
>  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)\"
> @@ -65,7 +67,13 @@ else
>  $(warning Your system does not have libgtk2, disabling test-inspect)
>  endif
>
> -ifeq ($(HAVE_LLVM),yes)
> +ifneq ($(HAVE_LLVM),yes)
> +$(warning Your system does not have llvm, disabling sparse-llvm)

Notice you use recursive assign here. It will cause "shell llvm-config
--version"
being execute every time $(LLVM_VERSION) is expanded. That slow down
the makefile. Because LLVM_VERSION don't change during the compile.
Better make it non-recursive assign so the llvm-config only evaluate once.

I also don't want to put the sparse-llvm rules section in nested if.
That is  makes it harder to read.

I am thinking some thing like this:

LLVM_VERSION := $(shell llvm-config --version 2>/dev/null)
LLVM_VERSION_LIST := $(subst ., ,$(LLVM_VERSION))
LLVM_VERSION_MAJOR := $(word 1, $(LLVM_VERSION_LIST))
HAVE_LLVM_V3 := $(shell [ "$(LLVM_VERSION_MAJOR)" -ge 3 ] > /dev/null
2>&1 && echo yes)

ifeq ($(HAVE_LLVM_V3),yes)

# rules to compile sparse-llvm

else

# warning of LLVM don't exist or too old

endif


Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux