1# Capstone Disassembler Engine 2# By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> 3 4ifndef BUILDDIR 5BLDIR = . 6OBJDIR = . 7else 8BLDIR = $(abspath $(BUILDDIR))/bindings/java 9OBJDIR = $(abspath $(BUILDDIR))/obj/bindings/java 10endif 11 12JNA = /usr/share/java/jna/jna.jar 13 14ifneq ($(wildcard $(JNA)),) 15else 16 ifneq ($(wildcard /usr/share/java/jna.jar),) 17 JNA = /usr/share/java/jna.jar 18 else 19 JNA = 20 endif 21endif 22 23CAPSTONE_JAVA = Capstone.java Arm_const.java Arm64_const.java Mips_const.java \ 24 X86_const.java Xcore_const.java Ppc_const.java Sparc_const.java\ 25 Sysz_const.java \ 26 Arm.java Arm64.java Mips.java X86.java Xcore.java Ppc.java\ 27 Sparc.java Systemz.java 28 29all: gen_const capstone tests 30 31capstone: capstone_class 32 @mkdir -p $(BLDIR) 33 cd $(OBJDIR) && jar cf $(BLDIR)/capstone.jar capstone/*.class 34 35capstone_class: jna 36ifdef BUILDDIR 37 @mkdir -p $(OBJDIR) 38 cd capstone && javac -d $(OBJDIR) -classpath $(JNA) $(CAPSTONE_JAVA) 39else 40 cd capstone && javac -classpath $(JNA) $(CAPSTONE_JAVA) 41endif 42 43tests: capstone_class jna 44 @mkdir -p $(OBJDIR) 45 javac -d $(OBJDIR) -classpath "$(JNA):$(BLDIR)/capstone.jar" Test.java\ 46 TestArm.java TestArm64.java TestMips.java TestX86.java TestXcore.java\ 47 TestPpc.java TestSparc.java TestSystemz.java 48 49gen_const: 50 cd ../ && python const_generator.py java 51 52jna: 53 @if [ ! $(JNA) ]; then echo "*** Unable to find JNA ***"; exit 1; fi 54 55clean: 56 rm -rf $(OBJDIR)/capstone/*.class 57 rm -rf $(OBJDIR)/*.class $(OBJDIR)/*.log $(BLDIR)/*.jar 58ifdef BUILDDIR 59 rm -rf $(BLDIR) 60 rm -rf $(OBJDIR) 61endif 62 63TESTS = test arm arm64 mips ppc sparc systemz x86 xcore 64check: 65 @for t in $(TESTS); do \ 66 echo Check $$t ... ; \ 67 ./run.sh $$t > /dev/null && echo OK || echo FAILED; \ 68 done 69 70