Fix Java Makefile on Darwin (#936)

* Fixes the logic for Dylib extensions on macOS.
* Adds an uninstall task and documentation.

Backports commit 94b116877670ed9bbe38b71e3b9ad28f10cb3775 from unicorn
This commit is contained in:
Jeremy Sears 2019-02-28 16:57:53 -05:00 committed by Lioncash
parent 07f315af47
commit c3c6e250e4
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 14 additions and 5 deletions

View file

@ -15,6 +15,9 @@ jar:
install: lib jar
$(MAKE) -f Makefile.build install
uninstall:
$(MAKE) -f Makefile.build uninstall
gen_const:
cd .. && python const_generator.py java

View file

@ -15,8 +15,7 @@ SRC := $(shell ls unicorn/*.java)
OS := $(shell uname)
ifeq ($(OS),Darwin)
LIB_EXT=.dylib
endif
ifeq ($(OS),Linux)
else ifeq ($(OS),Linux)
LIB_EXT=.so
else
LIB_EXT=.dll
@ -67,6 +66,10 @@ install: lib jar
cp libunicorn_java$(LIB_EXT) $(JAVA_HOME)/lib/ext
cp $(JARFILE) $(JAVA_HOME)/lib/ext
uninstall:
rm $(JAVA_HOME)/lib/ext/libunicorn_java$(LIB_EXT)
rm $(JAVA_HOME)/lib/ext/$(JARFILE)
gen_const:
cd .. && python const_generator.py java

View file

@ -32,3 +32,6 @@ The samples directory contains some sample code to show how to use Unicorn API.
- SampleNetworkAuditing.java
Unicorn sample for auditing network connection and file handling in shellcode.
To uninstall Java binding for Unicorn:
$ sudo make uninstall