Game Development Reference
In-Depth Information
JNI Headers
: The make target
jni
is defined to create the headers required by the
JNI interface using the
javah
command:
javah -jni -classpath ../../bin -d
include wolf.jni.Natives
. The class path must point to the location of the
compiled
wolf.jni.Natives
class,
-d
defines the directory where the output
headers will be stored, and
wolf.jni.Natives
is the Java class that contains the
native methods.
•
Listing 6-19.
The Makefile for Wolf 3D
CC = agcc
# All warning + Optimizations
CFLAGS = -Wall -O2
# Object files
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
wl_act1.o wl_act2.o wl_act3.o wl_agent.o wl_game.o \
wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \
wl_debug.o vi_comm.o sd_comm.o sd_null.o wl_draw.o
# JNI files
JNIOBJS = jni_wolf.o vi_null.o
OBJS += $(JNIOBJS)
# Main target
all: lib
# Library
lib: $(OBJS) j
ald -shared -o libwolf_jni.so $(OBJS)
.c.o:
@echo
$(CC) -fpic -c $(CFLAGS) $(INCLUDES) $<
# Create JNI headers
jni:
@echo "Creating JNI C headers..."
javah -jni -classpath ../../bin -d include wolf.jni.Natives
clean:
rm -rf *.o