diff --git a/Makefile b/Makefile index 8a6dcfd..c5bd36f 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ # This code is in the public domain #------------------------------------------------------------------------------- +UNAME := $(shell uname -s) + # The following variables will likely need to be customized, depending on where # and how you built LLVM & Clang. They can be overridden by setting them on the # make command line: "make VARNAME=VALUE", etc. @@ -55,7 +57,7 @@ LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --ldflags --libs --system-libs` # libs to be linked more than once because it uses globals for configuration # and plugin registration, and these trample over each other. LLVM_LDFLAGS_NOLIBS := `$(LLVM_BIN_PATH)/llvm-config --ldflags` -PLUGIN_LDFLAGS := -shared +PLUGIN_LDFLAGS := -shared -Wl,-undefined,dynamic_lookup CLANG_INCLUDES := \ -I$(LLVM_SRC_PATH)/tools/clang/include \ @@ -67,8 +69,15 @@ CLANG_INCLUDES := \ # because there are circular dependencies that make the correct order difficult # to specify and maintain. The linker group options make the linking somewhat # slower, but IMHO they're still perfectly fine for tools that link with Clang. -CLANG_LIBS := \ - -Wl,--start-group \ + +# Note: if using Darwin, may need to get rid of -lclangToolingCore. + +ifneq ($(UNAME),Darwin) + CLANG_LIBS += \ + -Wl,--start-group +endif + +CLANG_LIBS += \ -lclangAST \ -lclangAnalysis \ -lclangBasic \ @@ -88,8 +97,12 @@ CLANG_LIBS := \ -lclangStaticAnalyzerCore \ -lclangSerialization \ -lclangToolingCore \ - -lclangTooling \ - -Wl,--end-group + -lclangTooling + +ifneq ($(UNAME),Darwin) + CLANG_LIBS += \ + -Wl,--end-group +endif # Internal paths in this project: where to find sources, and where to put # build artifacts.