@@ -48,23 +48,13 @@ ifeq ($(OS),Windows_NT)
48
48
# LLVM compiled using MinGW on Windows appears to have problems with threads.
49
49
# Without this flag, linking results in errors like these:
50
50
# libLLVMSupport.a(Threading.cpp.obj):Threading.cpp:(.text+0x55): undefined reference to `std::thread::hardware_concurrency()'
51
- LLVM_OPTION += -DLLVM_ENABLE_THREADS=OFF
51
+ LLVM_OPTION += -DLLVM_ENABLE_THREADS=OFF -DLLVM_ENABLE_PIC=OFF
52
52
53
+ CGO_CPPFLAGS += -DCINDEX_NO_EXPORTS
53
54
CGO_LDFLAGS += -static -static-libgcc -static-libstdc++
54
55
CGO_LDFLAGS_EXTRA += -lversion
55
56
56
- # Build libclang manually because the CMake-based build system on Windows
57
- # doesn't allow building libclang as a static library.
58
- LIBCLANG_PATH = $(abspath build/libclang-custom.a)
59
- LIBCLANG_FILES = $(abspath $(wildcard $(LLVM_BUILDDIR ) /tools/clang/tools/libclang/CMakeFiles/libclang.dir/* .cpp.obj) )
60
-
61
- # Add the libclang dependency to the tinygo binary target.
62
- tinygo : $(LIBCLANG_PATH )
63
- test : $(LIBCLANG_PATH )
64
- # Build libclang.
65
- $(LIBCLANG_PATH ) : $(LIBCLANG_FILES )
66
- @mkdir -p build
67
- ar rcs $(LIBCLANG_PATH ) $^
57
+ LIBCLANG_PATH = $(abspath $(LLVM_BUILDDIR ) ) /lib/liblibclang.a
68
58
69
59
else ifeq ($(shell uname -s),Darwin)
70
60
MD5SUM = md5
@@ -87,7 +77,7 @@ LLD_LIBS = $(START_GROUP) -llldCOFF -llldCommon -llldCore -llldDriver -llldELF -
87
77
88
78
# For static linking.
89
79
ifneq ("$(wildcard $(LLVM_BUILDDIR ) /bin/llvm-config* ) ","")
90
- CGO_CPPFLAGS =$(shell $(LLVM_BUILDDIR ) /bin/llvm-config --cppflags) -I$(abspath $(LLVM_BUILDDIR ) ) /tools/clang/include -I$(abspath $(CLANG_SRC ) ) /include -I$(abspath $(LLD_SRC ) ) /include
80
+ CGO_CPPFLAGS+ =$(shell $(LLVM_BUILDDIR ) /bin/llvm-config --cppflags) -I$(abspath $(LLVM_BUILDDIR ) ) /tools/clang/include -I$(abspath $(CLANG_SRC ) ) /include -I$(abspath $(LLD_SRC ) ) /include
91
81
CGO_CXXFLAGS=-std =c++14
92
82
CGO_LDFLAGS+ =$(LIBCLANG_PATH ) -L$(abspath $(LLVM_BUILDDIR ) /lib) $(CLANG_LIBS ) $(LLD_LIBS ) $(shell $(LLVM_BUILDDIR ) /bin/llvm-config --ldflags --libs --system-libs $(LLVM_COMPONENTS ) ) -lstdc++ $(CGO_LDFLAGS_EXTRA )
93
83
endif
0 commit comments