diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2024-03-05 19:50:13 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2024-03-05 20:34:34 -0500 |
| commit | e093c21ed880ac3eb72119be15093ee04f8ce299 (patch) | |
| tree | 9f720ebdc0ae415734b1199ed341668c69710a94 /arch/armv7/thumb2_disasm/Makefile-linux | |
| parent | 0609276712622908254065546102381466033141 (diff) | |
Move architecture modules into the API repo
Diffstat (limited to 'arch/armv7/thumb2_disasm/Makefile-linux')
| -rw-r--r-- | arch/armv7/thumb2_disasm/Makefile-linux | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/armv7/thumb2_disasm/Makefile-linux b/arch/armv7/thumb2_disasm/Makefile-linux new file mode 100644 index 00000000..f537096e --- /dev/null +++ b/arch/armv7/thumb2_disasm/Makefile-linux @@ -0,0 +1,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 + |
