@@ -59,18 +59,13 @@ ifeq ($(OS),Windows_NT)
59
59
60
60
BINARYEN_OPTION += -DCMAKE_EXE_LINKER_FLAGS='-static-libgcc -static-libstdc++'
61
61
62
- LIBCLANG_NAME = libclang
63
-
64
62
else ifeq ($(shell uname -s),Darwin)
65
63
MD5SUM = md5
66
- LIBCLANG_NAME = clang
67
64
else ifeq ($(shell uname -s),FreeBSD)
68
65
MD5SUM = md5
69
- LIBCLANG_NAME = clang
70
66
START_GROUP = -Wl,--start-group
71
67
END_GROUP = -Wl,--end-group
72
68
else
73
- LIBCLANG_NAME = clang
74
69
START_GROUP = -Wl,--start-group
75
70
END_GROUP = -Wl,--end-group
76
71
endif
@@ -86,19 +81,22 @@ LLD_LIBS = $(START_GROUP) $(addprefix -l,$(LLD_LIB_NAMES)) $(END_GROUP)
86
81
# Other libraries that are needed to link TinyGo.
87
82
EXTRA_LIB_NAMES = LLVMInterpreter
88
83
84
+ # All libraries to be built and linked with the tinygo binary (lib/lib*.a).
85
+ LIB_NAMES = clang $(CLANG_LIB_NAMES ) $(LLD_LIB_NAMES ) $(EXTRA_LIB_NAMES )
86
+
89
87
# These build targets appear to be the only ones necessary to build all TinyGo
90
88
# dependencies. Only building a subset significantly speeds up rebuilding LLVM.
91
89
# The Makefile rules convert a name like lldELF to lib/liblldELF.a to match the
92
90
# library path (for ninja).
93
91
# This list also includes a few tools that are necessary as part of the full
94
92
# TinyGo build.
95
- NINJA_BUILD_TARGETS = clang llvm-config llvm-ar llvm-nm $(addprefix lib/lib,$(addsuffix .a,$(LIBCLANG_NAME ) $( CLANG_LIB_NAMES ) $( LLD_LIB_NAMES ) $( EXTRA_LIB_NAMES ) ) )
93
+ NINJA_BUILD_TARGETS = clang llvm-config llvm-ar llvm-nm $(addprefix lib/lib,$(addsuffix .a,$(LIB_NAMES ) ) )
96
94
97
95
# For static linking.
98
96
ifneq ("$(wildcard $(LLVM_BUILDDIR ) /bin/llvm-config* ) ","")
99
97
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
100
98
CGO_CXXFLAGS=-std =c++14
101
- CGO_LDFLAGS+ =$( abspath $( LLVM_BUILDDIR ) ) /lib/lib $( LIBCLANG_NAME ) .a -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 )
99
+ CGO_LDFLAGS+ =-L$(abspath $(LLVM_BUILDDIR ) /lib) -lclang $(CLANG_LIBS ) $(LLD_LIBS ) $(shell $(LLVM_BUILDDIR ) /bin/llvm-config --ldflags --libs --system-libs $(LLVM_COMPONENTS ) ) -lstdc++ $(CGO_LDFLAGS_EXTRA )
102
100
endif
103
101
104
102
0 commit comments