-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
76 lines (63 loc) · 1.98 KB
/
Makefile
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
CC=clang
CXX=clang++
LLVM_CONFIG=llvm-config
LLVM_LINK?=llvm-link
LLVM_DIS?=llvm-dis
CFORMAT ?= clang-format
CPPFILES = $(wildcard *.cpp)
CFILES = $(wildcard tests/**/*.c) $(wildcard tests/**/**/*.c)
export
all: manual-split find-and-split-static split-llvm-extract
manual-split find-and-split-static split-llvm-extract: %: %.cpp
$(CXX) -glldb $(shell $(LLVM_CONFIG) --cxxflags --ldflags --system-libs --libs) -std=c++17 $< -o $@
test-included: tests/test-mover-included.c
$(CC) -c -emit-llvm $< -o test.bc
./manual-split test.bc
test-llvm-extract: tests/test-llvm-extract.c
mkdir -p out
$(CC) -c -emit-llvm $< -o test.bc
./split-llvm-extract test.bc -o out
test-llvm-extract-static: tests/test-llvm-extract-static.c
mkdir -p out
$(CC) -fPIC -c -emit-llvm $< -o test.bc
./split-llvm-extract test.bc -o out
test-global-dependency: tests/test-global-dependency.c
mkdir -p out
$(CC) -fPIC -c -emit-llvm $< -o test.bc
./split-llvm-extract test.bc -o out
test-extern-const-constptr: $(wildcard tests/test-extern-const-constptr/*.c)
rm -Rf *.bc
rm -Rf out
mkdir -p out
$(CC) -fPIC -c -emit-llvm $^
$(LLVM_LINK) *.bc -o test.bc
./split-llvm-extract test.bc -o out
cp tests/Makefile out/.
cd out && $(MAKE)
rm -Rf out
test-extern-internal: $(wildcard tests/test-extern-internal/*.c)
rm -Rf *.bc
rm -Rf out
mkdir -p out
$(CC) -fPIC -c -emit-llvm $^
./split-llvm-extract test-extern-internal.bc -o out
cd out && $(LLVM_DIS) _main.bc && cat _main.ll | grep "hidden"
test-visibility: $(wildcard tests/test-visibility/*.c)
rm -Rf *.bc
rm -Rf out
mkdir -p out
$(CC) -fPIC -c -emit-llvm $^
$(LLVM_LINK) *.bc -o test.bc
./split-llvm-extract test.bc -o out
cp tests/Makefile out/.
cd out && $(MAKE)
rm -Rf out
test-compile: out
$(CC) $(wildcard out/*.bc) -o out/executable
lib:
$(CC) -O2 -shared -fPIC lib.bc -o libex.so
$(CC) -fPIE -L. -lex -Wl,-rpath,. main.bc -o test_lib
clang-format:
$(CFORMAT) -i $(CPPFILES) $(CFILES)
clean:
rm find-and-split-static manual-split split-llvm-extract