libConsole/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:51:15 +0200
changeset 84 f59d8a8e786f
parent 66 2b4f786d9073
child 102 b8ff193b1a01
permissions -rw-r--r--
struct hostent has no longer a member h_addr Current netdb.h lacks support for the old h_addr pointer without special USE_GNU defines... committer: Markus Bröker <mbroeker@largo.homelinux.org>

   CC = gcc
 JAVA = java
JAVAH = javah
JAVAC = javac
  LIB = lib/libConsole.so

ifdef JAVA_HOME
	JAVA_DIR="$(JAVA_HOME)"
else
	JAVA_DIR=/usr/lib/jvm/java-6-sun
endif

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)

Getch.class: $(SOURCES)
	$(JAVAC) -d . $(SOURCES)
	$(JAVAH) -jni -d include Console

$(LIB): $(OBJECTS)
	$(CC) -shared -Wl,-soname,libConsole.so.1,-rpath,lib $(OBJECTS) -o $@

.PHONY: clean

clean:
	rm -f include/Getch.h include/Console.h *.class *~ $(LIB)
	rm -f $(OBJECTS)

debug: Getch.class lib/libConsole.so
	LD_LIBRARY_PATH=lib $(JAVA) -cp . Getch

run: Getch.class $(LIB)
	$(JAVA) -cp . Getch