-
Notifications
You must be signed in to change notification settings - Fork 357
Expand file tree
/
Copy pathMakefile.linux
More file actions
38 lines (31 loc) · 1.28 KB
/
Makefile.linux
File metadata and controls
38 lines (31 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Using g++ is recommended for linking
CXX ?= g++
# -flto and --exclude-libs allow us to remove those parts of LLVM we don't use
CXX_FLTO_FLAGS ?= -flto
LD_FLTO_FLAGS ?= -flto=auto -flto -Wl,--exclude-libs=$(LLVM_EXCLUDE_LIB)
# -fPIC is required when compiling objects for a shared library
CXX_FPIC_FLAGS ?= -fPIC
ARCH = `uname -m`
CXXFLAGS := $(CPPFLAGS) $(CXXFLAGS) $(LLVM_CXXFLAGS) $(CXX_FLTO_FLAGS) $(CXX_FPIC_FLAGS)
LDFLAGS := $(LDFLAGS) $(LLVM_LDFLAGS) $(LD_FLTO_FLAGS)
LIBS = $(LLVM_LIBS)
INCLUDE = core.h
OBJ = assembly.o bitcode.o core.o initfini.o module.o value.o \
executionengine.o transforms.o passmanagers.o targets.o dylib.o \
linker.o object_file.o custom_passes.o orcjit.o
OUTPUT = libllvmlite.so
ifneq ("$(wildcard $(LLVM_LIBDIR)/clang)","")
BUILTINS_ARCHIVE := $(LLVM_LIBDIR)/clang/*/lib/linux/libclang_rt.builtins-${ARCH}.a
else
BUILTINS_ARCHIVE := $(LLVM_LIBDIR)/linux/libclang_rt.builtins-$(ARCH).a
endif
all: $(OUTPUT)
.cpp.o: $(INCLUDE)
$(CXX) -c $(CXXFLAGS) $< -o $@
$(OUTPUT): $(OBJ)
# static-libstdc++ avoids runtime dependencies on a
# particular libstdc++ version.'
$(CXX) $(CXX_STATIC_LINK) -shared $(CXXFLAGS) $(OBJ) -o $(OUTPUT) $(LDFLAGS) $(LIBS) \
-Wl,--whole-archive $(BUILTINS_ARCHIVE) -Wl,--no-whole-archive
clean:
rm -rf test $(OUTPUT) $(OBJ)