libConsole/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:49:13 +0200
changeset 63 5a82f89d607e
parent 55 2a20d0184041
child 66 2b4f786d9073
permissions -rw-r--r--
uint vs size_t and two bugfixes in fak and unicode * Better Description of copy.cc * mem2swap throws a perror on failure committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
CC=gcc
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
JAVA=java
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
JAVAH=javah
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
JAVAC=javac
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
LIB=lib/libConsole.so
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
ifdef JAVA_HOME
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
	JAVA_DIR="$(JAVA_HOME)"
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
else
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
	JAVA_DIR=/usr/lib/jvm/java-6-sun
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
endif
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
INCLUDE=-I$(JAVA_DIR)/include -I$(JAVA_DIR)/include/linux -Iinclude
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
SOURCES= \
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
	Getch.java \
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
	Console.java
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
OBJECTS= \
53
6b3d7e3418c1 getch.c renamed to cross_getch.c
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 49
diff changeset
    19
	cross_getch.o
49
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
.SUFFIXES: .java
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    23
.c.o:
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    24
	@echo "JAVA_HOME=$(JAVA_DIR)"
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    25
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    26
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    27
all: Getch.class $(LIB)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    28
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    29
Getch.class: $(SOURCES)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    30
	$(JAVAC) -d . $(SOURCES)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    31
	$(JAVAH) -jni -d include Console
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    32
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    33
$(LIB): $(OBJECTS)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    34
	$(CC) -shared -Wl,-soname,libConsole.so.1,-rpath,lib $(OBJECTS) -o $@
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    35
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    36
.PHONY: clean
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    37
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    38
clean:
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    39
	rm -f include/Getch.h include/Console.h *.class *~ $(LIB)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    40
	rm -f $(OBJECTS)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    41
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    42
debug: Getch.class lib/libConsole.so
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    43
	LD_LIBRARY_PATH=lib $(JAVA) -cp . Getch
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    44
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    45
run: Getch.class $(LIB)
77094ec383cf libConsole: a java native interface example
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    46
	$(JAVA) -cp . Getch