filetraverser/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Fri, 19 Nov 2010 00:34:26 +0100
changeset 155 a54dcc86addb
parent 151 a8c2649cf277
permissions -rw-r--r--
cunit needs libcunit and libncurses committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
151
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
   CC = gcc
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
 JAVA = java
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
JAVAH = javah
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
JAVAC = javac
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
   TC = Unix
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
  LIB = lib/lib$(TC).so
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
SOURCES  = FileTraverser.java
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
SOURCES += $(TC).java
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
OBJECTS  = unix.o
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
ifdef JAVA_HOME
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
	JAVA_DIR="$(JAVA_HOME)"
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
else
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
	JAVA_DIR=/usr/lib/jvm/java-6-sun
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
endif
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
INCLUDE = -I$(JAVA_DIR)/include -I$(JAVA_DIR)/include/linux -Iinclude
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
.SUFFIXES: .java
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    23
.c.o:
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    24
	@echo "JAVA_HOME=$(JAVA_DIR)"
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    25
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    26
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    27
all: $(TC).class $(LIB)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    28
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    29
$(TC).class: $(SOURCES)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    30
	$(JAVAC) -d . $(SOURCES)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    31
	$(JAVAH) -jni -d include $(TC)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    32
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    33
$(LIB): $(OBJECTS)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    34
	$(CC) -shared -Wl,-soname,lib$(TC).so.1,-rpath,lib $(OBJECTS) -o $@
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    35
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    36
.PHONY: clean
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    37
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    38
clean:
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    39
	rm -f include/$(TC).h *.class *~ $(LIB)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    40
	rm -f $(OBJECTS)
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    41
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    42
debug: all
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    43
	LD_LIBRARY_PATH=lib $(JAVA) -cp . FileTraverser
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    44
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    45
run: all
a8c2649cf277 FileTraverser Demo added
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    46
	$(JAVA) -Djava.library.path=lib -cp . FileTraverser $(HOME) 1