Fix Java Makefile on Darwin (#936)
* Fixes the logic for Dylib extensions on macOS. * Adds an uninstall task and documentation.
This commit is contained in:

committed by
Nguyen Anh Quynh

parent
dab5060005
commit
94b1168776
@ -15,6 +15,9 @@ jar:
|
|||||||
install: lib jar
|
install: lib jar
|
||||||
$(MAKE) -f Makefile.build install
|
$(MAKE) -f Makefile.build install
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(MAKE) -f Makefile.build uninstall
|
||||||
|
|
||||||
gen_const:
|
gen_const:
|
||||||
cd .. && python const_generator.py java
|
cd .. && python const_generator.py java
|
||||||
|
|
||||||
|
@ -15,8 +15,7 @@ SRC := $(shell ls unicorn/*.java)
|
|||||||
OS := $(shell uname)
|
OS := $(shell uname)
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
LIB_EXT=.dylib
|
LIB_EXT=.dylib
|
||||||
endif
|
else ifeq ($(OS),Linux)
|
||||||
ifeq ($(OS),Linux)
|
|
||||||
LIB_EXT=.so
|
LIB_EXT=.so
|
||||||
else
|
else
|
||||||
LIB_EXT=.dll
|
LIB_EXT=.dll
|
||||||
@ -48,7 +47,7 @@ all: lib jar samples
|
|||||||
|
|
||||||
unicorn_Unicorn.h: unicorn/Unicorn.java
|
unicorn_Unicorn.h: unicorn/Unicorn.java
|
||||||
javah unicorn.Unicorn
|
javah unicorn.Unicorn
|
||||||
|
|
||||||
unicorn_Unicorn.o: unicorn_Unicorn.c unicorn_Unicorn.h
|
unicorn_Unicorn.o: unicorn_Unicorn.c unicorn_Unicorn.h
|
||||||
$(CC) -c $(CFLAGS) $(INCS) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCS) $< -o $@
|
||||||
|
|
||||||
@ -61,12 +60,16 @@ samples: $(SAMPLES:.java=.class)
|
|||||||
jarfiles: $(SRC:.java=.class)
|
jarfiles: $(SRC:.java=.class)
|
||||||
|
|
||||||
jar: jarfiles
|
jar: jarfiles
|
||||||
jar cf $(JARFILE) unicorn/*.class
|
jar cf $(JARFILE) unicorn/*.class
|
||||||
|
|
||||||
install: lib jar
|
install: lib jar
|
||||||
cp libunicorn_java$(LIB_EXT) $(JAVA_HOME)/lib/ext
|
cp libunicorn_java$(LIB_EXT) $(JAVA_HOME)/lib/ext
|
||||||
cp $(JARFILE) $(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:
|
gen_const:
|
||||||
cd .. && python const_generator.py java
|
cd .. && python const_generator.py java
|
||||||
|
|
||||||
@ -75,4 +78,4 @@ clean:
|
|||||||
rm samples/*.class
|
rm samples/*.class
|
||||||
rm *.so
|
rm *.so
|
||||||
rm *.dylib
|
rm *.dylib
|
||||||
rm *.dll
|
rm *.dll
|
||||||
|
@ -32,3 +32,6 @@ The samples directory contains some sample code to show how to use Unicorn API.
|
|||||||
- SampleNetworkAuditing.java
|
- SampleNetworkAuditing.java
|
||||||
Unicorn sample for auditing network connection and file handling in shellcode.
|
Unicorn sample for auditing network connection and file handling in shellcode.
|
||||||
|
|
||||||
|
To uninstall Java binding for Unicorn:
|
||||||
|
|
||||||
|
$ sudo make uninstall
|
||||||
|
Reference in New Issue
Block a user