libConsole/Makefile
changeset 149 5acf77b9b7a0
parent 102 b8ff193b1a01
child 166 ecd6492274ad
--- a/libConsole/Makefile
+++ b/libConsole/Makefile
@@ -2,7 +2,13 @@
  JAVA = java
 JAVAH = javah
 JAVAC = javac
-  LIB = lib/libConsole.so
+   TC = Console
+  LIB = lib/lib$(TC).so
+
+SOURCES  = Getch.java
+SOURCES += $(TC).java
+
+OBJECTS  = cross_getch.o
 
 ifdef JAVA_HOME
 	JAVA_DIR="$(JAVA_HOME)"
@@ -12,34 +18,29 @@
 
 INCLUDE = -I$(JAVA_DIR)/include -I$(JAVA_DIR)/include/linux -Iinclude
 
-SOURCES  = Getch.java
-SOURCES += Console.java
-
-OBJECTS  = cross_getch.o
-
 .SUFFIXES: .java
 
 .c.o:
 	@echo "JAVA_HOME=$(JAVA_DIR)"
 	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
 
-all: Getch.class $(LIB)
+all: $(TC).class $(LIB)
 
-Getch.class: $(SOURCES)
+$(TC).class: $(SOURCES)
 	$(JAVAC) -d . $(SOURCES)
-	$(JAVAH) -jni -d include Console
+	$(JAVAH) -jni -d include $(TC)
 
 $(LIB): $(OBJECTS)
-	$(CC) -shared -Wl,-soname,libConsole.so.1,-rpath,lib $(OBJECTS) -o $@
+	$(CC) -shared -Wl,-soname,lib$(TC).so.1,-rpath,lib $(OBJECTS) -o $@
 
 .PHONY: clean
 
 clean:
-	rm -f include/Getch.h include/Console.h *.class *~ $(LIB)
+	rm -f include/$(TC).h *.class *~ $(LIB)
 	rm -f $(OBJECTS)
 
-debug: Getch.class lib/libConsole.so
+debug: all
 	LD_LIBRARY_PATH=lib $(JAVA) -cp . Getch
 
-run: Getch.class $(LIB)
+run: all
 	$(JAVA) -Djava.library.path=lib -cp . Getch