From daf5d0b63a2ce0e47b6e789fb7cc72e09ce7be56 Mon Sep 17 00:00:00 2001 From: Pure White Date: Tue, 18 Jan 2022 02:32:36 +0800 Subject: [PATCH] fix: makefile on macOS (#2535) * fix: makefile on macOS --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f9902f7d..6b82f75f 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,13 @@ LLVM_BUILDDIR ?= llvm-build LLVM_PROJECTDIR ?= llvm-project CLANG_SRC ?= $(LLVM_PROJECTDIR)/clang LLD_SRC ?= $(LLVM_PROJECTDIR)/lld +BREW_PREFIX := $(shell brew --prefix) # Try to autodetect LLVM build tools. -# FIXME(#2438): This doesn't work on darwin now. Homebrew installed llvm is key-only. detect = $(shell command -v $(1) 2> /dev/null && echo $(1)) -CLANG ?= $(word 1,$(abspath $(call detect,llvm-build/bin/clang))$(call detect,clang-13)$(call detect,clang-12)$(call detect,clang-11)$(call detect,clang)) -LLVM_AR ?= $(word 1,$(abspath $(call detect,llvm-build/bin/llvm-ar))$(call detect,llvm-ar-13)$(call detect,llvm-ar-12)$(call detect,llvm-ar-11)$(call detect,llvm-ar)) -LLVM_NM ?= $(word 1,$(abspath $(call detect,llvm-build/bin/llvm-nm))$(call detect,llvm-nm-13)$(call detect,llvm-nm-12)$(call detect,llvm-nm-11)$(call detect,llvm-nm)) +CLANG ?= $(word 1,$(abspath $(call detect,llvm-build/bin/clang))$(call detect,$(BREW_PREFIX)/opt/llvm@13/bin/clang-13)$(call detect,clang-13)$(call detect,$(BREW_PREFIX)/opt/llvm@12/bin/clang-12)$(call detect,clang-12)$(call detect,$(BREW_PREFIX)/opt/llvm@11/bin/clang-11)$(call detect,clang-11)$(call detect,$(BREW_PREFIX)/opt/llvm/bin/clang)$(call detect,clang)) +LLVM_AR ?= $(word 1,$(abspath $(call detect,llvm-build/bin/llvm-ar))$(call detect,$(BREW_PREFIX)/opt/llvm@13/bin/llvm-ar-13)$(call detect,llvm-ar-13)$(call detect,$(BREW_PREFIX)/opt/llvm@12/bin/llvm-ar-12)$(call detect,llvm-ar-12)$(call detect,$(BREW_PREFIX)/opt/llvm@11/bin/llvm-ar-11)$(call detect,llvm-ar-11)$(call detect,$(BREW_PREFIX)/opt/llvm/bin/llvm-ar)$(call detect,llvm-ar)) +LLVM_NM ?= $(word 1,$(abspath $(call detect,llvm-build/bin/llvm-nm))$(call detect,$(BREW_PREFIX)/opt/llvm@13/bin/llvm-nm-13)$(call detect,llvm-nm-13)$(call detect,$(BREW_PREFIX)/opt/llvm@12/bin/llvm-nm-12)$(call detect,llvm-nm-12)$(call detect,$(BREW_PREFIX)/opt/llvm@11/bin/llvm-nm-11)$(call detect,llvm-nm-11)$(call detect,$(BREW_PREFIX)/opt/llvm/bin/llvm-nm)$(call detect,llvm-nm)) # Go binary and GOROOT to select GO ?= go