equal
deleted
inserted
replaced
|
1 CC=gcc |
|
2 JAVA=java |
|
3 JAVAH=javah |
|
4 JAVAC=javac |
|
5 LIB=lib/libConsole.so |
|
6 |
|
7 ifdef JAVA_HOME |
|
8 JAVA_DIR="$(JAVA_HOME)" |
|
9 else |
|
10 JAVA_DIR=/usr/lib/jvm/java-6-sun |
|
11 endif |
|
12 |
|
13 INCLUDE=-I$(JAVA_DIR)/include -I$(JAVA_DIR)/include/linux -Iinclude |
|
14 SOURCES= \ |
|
15 Getch.java \ |
|
16 Console.java |
|
17 |
|
18 OBJECTS= \ |
|
19 getch.o |
|
20 |
|
21 .SUFFIXES: .java |
|
22 |
|
23 .c.o: |
|
24 @echo "JAVA_HOME=$(JAVA_DIR)" |
|
25 $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ |
|
26 |
|
27 all: Getch.class $(LIB) |
|
28 |
|
29 Getch.class: $(SOURCES) |
|
30 $(JAVAC) -d . $(SOURCES) |
|
31 $(JAVAH) -jni -d include Console |
|
32 |
|
33 $(LIB): $(OBJECTS) |
|
34 $(CC) -shared -Wl,-soname,libConsole.so.1,-rpath,lib $(OBJECTS) -o $@ |
|
35 |
|
36 .PHONY: clean |
|
37 |
|
38 clean: |
|
39 rm -f include/Getch.h include/Console.h *.class *~ $(LIB) |
|
40 rm -f $(OBJECTS) |
|
41 |
|
42 debug: Getch.class lib/libConsole.so |
|
43 LD_LIBRARY_PATH=lib $(JAVA) -cp . Getch |
|
44 |
|
45 run: Getch.class $(LIB) |
|
46 @echo "You need to copy libConsole.(so|dll) to $(JAVA_DIR)/jre/lib/i386" |
|
47 $(JAVA) -cp . Getch |