Makefile: fix LLVM tools detection for wasi-libc

This makes the `make wasi-libc` command much more reliable and makes the
CI configuration simpler. Also, it avoids warnings when they are not
relevant.
This commit is contained in:
Ayke van Laethem
2020-02-27 16:58:41 +01:00
committed by Ayke
parent 6896b0014b
commit 978a0cd9b0
3 changed files with 22 additions and 22 deletions
+14 -14
View File
@@ -7,26 +7,26 @@ LLVM_BUILDDIR ?= llvm-build
CLANG_SRC ?= llvm-project/clang
LLD_SRC ?= llvm-project/lld
# Default tool selection.
CLANG ?= clang-9
# Try to autodetect llvm-ar and llvm-nm
ifneq (, $(shell command -v llvm-ar-9 2> /dev/null))
# Try to autodetect LLVM build tools.
ifneq (, $(shell command -v llvm-build/bin/clang 2> /dev/null))
CLANG ?= $(abspath llvm-build/bin/clang)
else
CLANG ?= clang-9
endif
ifneq (, $(shell command -v llvm-build/bin/llvm-ar 2> /dev/null))
LLVM_AR ?= $(abspath llvm-build/bin/llvm-ar)
else ifneq (, $(shell command -v llvm-ar-9 2> /dev/null))
LLVM_AR ?= llvm-ar-9
else ifneq (, $(shell command -v llvm-ar 2> /dev/null))
else
LLVM_AR ?= llvm-ar
endif
ifneq (, $(shell command -v llvm-nm-9 2> /dev/null))
ifneq (, $(shell command -v llvm-build/bin/llvm-nm 2> /dev/null))
LLVM_NM ?= $(abspath llvm-build/bin/llvm-nm)
else ifneq (, $(shell command -v llvm-nm-9 2> /dev/null))
LLVM_NM ?= llvm-nm-9
else ifneq (, $(shell command -v llvm-nm 2> /dev/null))
else
LLVM_NM ?= llvm-nm
endif
ifndef LLVM_AR
$(warning llvm-ar not found)
endif
ifndef LLVM_NM
$(warning llvm-nm not found)
endif
# Go binary and GOROOT to select
GO ?= go