-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
97 lines (68 loc) · 1.71 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.PHONY: clean all install
PREFIX = /usr/local
# keep temporary files
# .SECONDARY:
SO = libegion.so
A = libegion.a
# optimisation
OFLAG ?= -O0
# Tracing
MAX_TRACE_LEN ?= 42
VERBOSE ?= 0
# compiled without -fPIC
O = __VERIFIER.o __trace_jump.o
# compiled with -fPIC
LO = $(O:.o=.lo)
# for angr
CFLAGS += -no-pie
all: $(SO) $(A) trace/as
clean:
rm -f $(SO) $(A) $(O) $(LO)
rm -rf trace/
%.s: %.i
$(CC) -S -g $(OFLAG) -o $@ $^
%.s: %.c
$(CC) -S -g $(OFLAG) -o $@ $^
%.instr.s: %.s
python3 tracejump.py $^ $@
%.instr: %.instr.o __trace_jump.o __VERIFIER.c __VERIFIER_assume.instr.s __trace_buffered.c
$(CC) -g -o $@ $^ -no-pie -DMAX_TRACE_LEN=$(MAX_TRACE_LEN) -DVERBOSE=$(VERBOSE)
%.instr.obj: %.instr
objdump -d $^ > $@
$(SO): CFLAGS += -fPIC
$(SO): LDFLAGS += -shared
%.lo: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.lo: %.s
$(CC) $(CFLAGS) -c -o $@ $<
$(SO): $(LO)
$(LD) $(LDFLAGS) -o $@ $^
$(A): $(O)
$(AR) $(ARFLAGS) $@ $^
trace:
mkdir $@
trace/as: trace
ln trace-as trace/as
install: $(SO) $(A) trace-as trace-cc
install -m755 -t $(PREFIX)/bin trace-as
install -m755 -t $(PREFIX)/bin trace-cc
install -m755 -t $(PREFIX)/lib $(SO)
install -m644 -t $(PREFIX)/lib $(A)
mkdir -p $(PREFIX)/bin/trace
ln -sf $(PREFIX)/bin/trace-as $(PREFIX)/bin/trace/as
uninstall:
rm $(PREFIX)/bin/trace-as
rm $(PREFIX)/bin/trace-cc
rm $(PREFIX)/lib/$(SO)
rm $(PREFIX)/lib/$(A)
rm $(PREFIX)/bin/trace/as
rmdir $(PREFIX)/bin/trace
LOGS = $(wildcard test/results/legion.*.files/*)
ZIPS = $(addsuffix /test-suite.zip,$(LOGS))
.PHONY: zips
%/test-suite.zip: %/Legion
zip $@ $^ -r
zips: $(ZIPS)
echo $(ZIPS)
package.zip: legion-sv Legion.py __VERIFIER.c __trace_jump.s tracejump.py benchmark validate legion.xml
zip -r $@ $^ lib