about summary refs log tree commit diff
path: root/llvm_mode/Makefile
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-22 19:38:57 +0200
committerAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-22 19:38:57 +0200
commit9aefe7a0402d4389aaff1f070c84ea1b95abc0fd (patch)
tree9e0f9f008d7a41c43a09304e8bb5364a14a8d75e /llvm_mode/Makefile
parent17bb51756faeaeda6fb17d63ede0a1a9d8ae4b5c (diff)
parent5044bb0332bf2bed8fe8691f411bd9c144e332af (diff)
downloadafl++-9aefe7a0402d4389aaff1f070c84ea1b95abc0fd.tar.gz
Merge branch 'master' of github.com:vanhauser-thc/AFLplusplus
Diffstat (limited to 'llvm_mode/Makefile')
-rw-r--r--llvm_mode/Makefile18
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index f635ca83..2d35505e 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -37,7 +37,8 @@ endif
 
 LLVMVER  = $(shell $(LLVM_CONFIG) --version)
 LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^[12]|^3\.0|^1[0-9]' && echo 1 || echo 0 )
-LLVM_MAJOR = ($shell $(LLVM_CONFIG) --version | sed 's/\..*//')
+LLVM_MAJOR = $(shell $(LLVM_CONFIG) --version | sed 's/\..*//')
+LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir)
 
 ifeq "$(LLVM_UNSUPPORTED)" "1"
   $(warn llvm_mode only supports versions 3.8.0 up to 9)
@@ -77,11 +78,18 @@ endif
 # this seems to be busted on some distros, so using the one in $PATH is
 # probably better.
 
-ifeq "$(origin CC)" "default"
-  ifeq "$(shell uname)" "OpenBSD"
-    CC         = $(BIN_PATH)/clang
-    CXX        = $(BIN_PATH)/clang++
+CC         = $(LLVM_BINDIR)/clang
+CXX        = $(LLVM_BINDIR)/clang++
+
+ifeq "$(shell test -e $(CC) || echo 1 )" "1"
+  # llvm-config --bindir is not providing a valid path, so ...
+  ifeq "$(shell test -e "$(BIN_DIR)/clang" && echo 1)" "1"
+    # we found one in the local install directory, lets use these
+    CC         = $(BIN_DIR)/clang
+    CXX        = $(BIN_DIR)/clang++
   else
+    # hope for the best
+    $(warn we have trouble finding clang/clang++ - llvm-config is not helping us)
     CC         = clang
     CXX        = clang++
   endif