filetraverser/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Fri, 19 Nov 2010 12:23:24 +0100
changeset 158 2cddd4d26139
parent 151 a8c2649cf277
permissions -rw-r--r--
removed unnecessary #includes committer: Markus Bröker <mbroeker@largo.homelinux.org>

   CC = gcc
 JAVA = java
JAVAH = javah
JAVAC = javac
   TC = Unix
  LIB = lib/lib$(TC).so

SOURCES  = FileTraverser.java
SOURCES += $(TC).java

OBJECTS  = unix.o

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

.SUFFIXES: .java

.c.o:
	@echo "JAVA_HOME=$(JAVA_DIR)"
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@

all: $(TC).class $(LIB)

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

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

.PHONY: clean

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

debug: all
	LD_LIBRARY_PATH=lib $(JAVA) -cp . FileTraverser

run: all
	$(JAVA) -Djava.library.path=lib -cp . FileTraverser $(HOME) 1