blob: f537096ebdf72477dbc9132047c8e632d423c174 (
plain)
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
|
# export DYLD_LIBRARY_PATH=/usr/local/opt/capstone/lib/:$DYLD_LIBRARY_PATH
CPPFLAGS =
# all paths reference this development environment (vs. installed path)
PATH_DEV = $(abspath $(shell pwd)/../..)
PATH_API = $(PATH_DEV)/api
PATH_CORE = $(PATH_DEV)/core
PATH_PLUGINS = $(PATH_DEV)/ui/plugins
#
# debug stuff
#
# DEBUG_BUILD - files are compiled with debugging info, no optimizations (if you want to attach debugger)
# DEBUG_DECOMP - code included to print decomposition/decode debugging info
# DEBUG_DISASM - code included to print disassembling debugging info
DEBUG_ALL ?=
ifneq ($(DEBUG_ALL),)
DEBUG_BUILD = 1
DEBUG_DECOMP = 1
DEBUG_DISASM = 1
endif
DEBUG_BUILD ?=
ifneq ($(DEBUG_BUILD),)
$(info DEBUG_BUILD is on!)
CPPFLAGS += -g -O0 -DDEBUG_BUILD
else
CPPFLAGS += -O3
endif
DEBUG_DECOMP ?=
ifneq ($(DEBUG_DECOMP),)
$(info DEBUG_DECOMP is on!)
CPPFLAGS += -DDEBUG_DECOMP
endif
DEBUG_DISASM ?=
ifneq ($(DEBUG_DISASM),)
$(info DEBUG_DISASM is on!)
CPPFLAGS += -DDEBUG_DISASM
endif
CPPFLAGS += -I/usr/local/include -I../armv7 -std=c++11
all: libthumb.so disassembler.o testadapt.so test
#
# shared objects (for direct use and testing)
#
libthumb.so: disassembler.o spec.o
g++ -shared -fPIC $(CPPFLAGS) -o libthumb.so disassembler.o spec.o
disassembler.o: disassembler.cpp disassembler.h spec.o
g++ -fPIC $(CPPFLAGS) disassembler.cpp -c
testadapt.so: testadapt.cpp disassembler.o
g++ $(CPPFLAGS) \
-I$(PATH_API) \
-L$(PATH_PLUGINS) -larch_armv7 \
-L$(PATH_CORE) -lbinaryninjacore \
-L. -lthumb \
-lcapstone \
-shared -fPIC -o testadapt.so testadapt.cpp
patchelf --add-needed libthumb.so testadapt.so
patchelf --add-needed libcapstone.so testadapt.so
patchelf --add-needed libarch_armv7.so testadapt.so
patchelf --set-rpath /home/negasora/binaryninja/arch/thumb2:/home/negasora/binaryninja/arch/armv7 testadapt.so
test: test.cpp disassembler.o
g++ $(CPPFLAGS) -L../../core -lbinaryninjacore libthumb.so -lcapstone -o test test.cpp testadapt.so
spec.o: spec.cpp
g++ -fPIC $(CPPFLAGS) spec.cpp -c
spec.cpp: generator.py ./arm_pcode_parser/codegencpp.py spec.txt
./generator.py spec_misc.txt
forcegen:
echo '' > spec.cpp
./generator.py spec_misc.txt
#
# generated stuff
#
clean:
rm *.o *.so
rm -rf test.dSYM
rm test
|