-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
32 lines (25 loc) · 1.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
help:
@echo 'Makefile for JNI Example '
@echo ' '
@echo 'Usage: '
@echo ' make jni-compile compile native C code '
@echo ' make java-compile compile Java code '
@echo ' make clean remove generated shared library '
@echo ' make run run JNI Example '
@echo ' '
@echo "Note: To work from Java IDE you'll probably need only jni-compile target"
jni-compile: net_sukharevd_jni_example_MatrixMultiplier.so
net_sukharevd_jni_example_MatrixMultiplier.so:
gcc -O3 -fPIC -shared -I $(JAVA_HOME)/include/ \
-I $(JAVA_HOME)/include/linux/ \
src/net_sukharevd_jni_example_MatrixMultiplier.c \
-o net_sukharevd_jni_example_MatrixMultiplier.so
java-compile: src/net/sukharevd/jni/example/%.class
src/net/sukharevd/jni/example/%.class:
javac src/net/sukharevd/jni/example/*.java
clean:
[ ! -f net_sukharevd_jni_example_MatrixMultiplier.so ] || \
rm net_sukharevd_jni_example_MatrixMultiplier.so
run: clean java-compile jni-compile
java -cp src/ net.sukharevd.jni.example.MatrixMultiplier
.PHONY: clean java-compile jni-compile run help