-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile.native
More file actions
30 lines (23 loc) · 748 Bytes
/
Makefile.native
File metadata and controls
30 lines (23 loc) · 748 Bytes
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
# Build the Bindj for Linux.
# Expects CLASSPATH to be set appropriately for running, and JAVA_HOME
# to be passed in so we can find the tools.
OBJDIR = target/obj
SODIR = target/so
SRCDIR = src/main/c
INCLUDE = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux \
-I${JAVA_HOME}/../include -I${JAVA_HOME}/../include/linux
C_OBJ = $(OBJDIR)/HelloWorldJNIwithRegisterNatives.o
C_SRC = $(SRCDIR)/HelloWorldJNIwithRegisterNatives.c
C_SO = $(SODIR)/libHelloWorldJNIwithRegisterNatives.so
.PHONY: all
all: $(C_SO)
$(C_SO): $(C_OBJ) $(SODIR)
gcc -fPIC -shared -o $@ $(C_OBJ)
$(C_OBJ): $(C_SRC) $(HEADERS) $(OBJDIR)
gcc -fPIC -c -O -o $@ $(INCLUDE) $(C_SRC)
$(OBJDIR):
mkdir $(OBJDIR)
$(SODIR):
mkdir $(SODIR)
clean:
rm -rf $(C_OBJ) $(C_SO)