Replace javah by javac -h, only write new constant files if something changes.

The const_generator changes help to ensure that e.g. Java rebuilds don't keep
rebuilding everything.
This commit is contained in:
Robert Xiao
2023-07-06 20:12:36 -07:00
parent 763d04127c
commit f55e7834ba
4 changed files with 24 additions and 9 deletions

View File

@@ -1,2 +1 @@
target/
unicorn_Unicorn.h

View File

@@ -26,14 +26,11 @@ CFLAGS=-fPIC
LDFLAGS=-shared -fPIC
# May also use -lunicorn to dynamically link against the installed unicorn
LIBS=../../build/libunicorn.a
INCS=-I$(JAVA_INC) -I$(JAVA_PLATFORM_INC) -I$(UNICORN_INC)
INCS=-I target/headers -I$(JAVA_INC) -I$(JAVA_PLATFORM_INC) -I$(UNICORN_INC)
OBJS=unicorn_Unicorn.o
unicorn_Unicorn.h: src/main/java/unicorn/Unicorn.java
javah -cp src/main/java -o $@ unicorn.Unicorn
unicorn_Unicorn.o: unicorn_Unicorn.c unicorn_Unicorn.h
unicorn_Unicorn.o: unicorn_Unicorn.c target/headers/unicorn_Unicorn.h
$(CC) -O2 -Wall -Wextra -Wno-unused-parameter -c $(CFLAGS) $(INCS) $< -o $@
libunicorn_java$(LIB_EXT): $(OBJS)
@@ -41,7 +38,6 @@ libunicorn_java$(LIB_EXT): $(OBJS)
clean:
rm -f libunicorn_java$(LIB_EXT)
rm -f unicorn_Unicorn.h
rm -f $(OBJS)
.PHONY: all clean

View File

@@ -33,6 +33,12 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<compilerArgs>
<arg>-h</arg>
<arg>target/headers</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</pluginManagement>