aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-17 21:05:42 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-17 21:05:42 +0100
commitf6ba2ed10f41e5a9fc41eba6a2a610084910458d (patch)
treed7e8de891c3eaaa213cbe6b96f584f63d65f742e /Makefile
parentjni stuff (diff)
downloadsha3sum-f6ba2ed10f41e5a9fc41eba6a2a610084910458d.tar.gz
sha3sum-f6ba2ed10f41e5a9fc41eba6a2a610084910458d.tar.bz2
sha3sum-f6ba2ed10f41e5a9fc41eba6a2a610084910458d.tar.xz
add jni .so to makefile
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 9 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 8a9adc0..9f69c97 100644
--- a/Makefile
+++ b/Makefile
@@ -18,12 +18,15 @@ CPPFLAGS=
LDFLAGS=
C_FLAGS=$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+JNI_INCLUDE=-I$${JAVA_HOME}/include
+JNI_FLAGS=$(JNI_INCLUDE) -fPIC -shared
+
JAVA_CLASSES = $(shell find "pure-java" | grep '\.java$$' | sed -e 's_^_bin/_g' -e 's_java$$_class_g')
C_OBJS = $(shell find "c" | grep '\.h$$' | sed -e 's_^_bin/_g' -e 's_h$$_o_g')
C_BINS = bin/c/sha3sum
-all: pure-java c
+all: pure-java c java-c-jni
pure-java: $(JAVA_CLASSES)
@@ -40,6 +43,11 @@ bin/c/%: c/%.c
mkdir -p "bin/c"
$(CC) $(C_FLAGS) -o "$@" "c/$*".c "c/"*.o
+java-c-jni: bin/java-c-jni/SHA3.so
+bin/java-c-jni/%.so: java-c-jni/%.c
+ mkdir -p "bin/java-c-jni"
+ gcc $(C_FLAGS) $(JNI_FLAGS) "java-c-jni/$*.c" -o "bin/java-c-jni/$*.so"
+
.PHONY: clean
clean: