Makefile added / pkg-config descriptor
[metux-java.git] / package.mk
blobf14a106007213094b2ae8ce7891a1e8a8a02876e
2 PKGDIR=$(subst .,/,$(PACKAGE))
3 CLASSPATH="$(BUILDDIR):$(CLASSPATH_ADD):."
4 CLASS_SOURCES=$(shell for i in $(CLASSES); do echo $$i.java; done)
5 REAL_CLASS_FILES=$(shell for i in $(CLASSES); do echo $(BUILDDIR)/$(PKGDIR)/$$i.class; done)
6 REAL_OBJ_FILES=$(shell for i in $(CLASSES); do echo $(BUILDDIR)/$(PKGDIR)/$$i.o; done)
7 XXX_CLASS_FILES=$(shell for i in $(CLASSES); do echo $(PKGDIR)/$$i.class; done)
8 XXX_OBJ_FILES=$(shell for i in $(CLASSES); do echo $(PKGDIR)/$$i.o; done)
9 IMPORT_FILES=$(shell for i in $(IMPORTS); do echo $(BUILDDIR)/$$i.jar; done)
10 #CMD_JAVAC=gcj -C
11 CMD_JAVAC=javac
12 CMD_JAVAR=java
14 all: prepare $(REAL_CLASS_FILES) run-unit-test
16 .SUFFIXES: .java .class
18 $(BUILDDIR)$(PACKAGE).jar: $(REAL_CLASS_FILES)
19 cd $(BUILDDIR)/ && jar cvf $(PACKAGE).jar $(XXX_CLASS_FILES)
21 prepare:
22 mkdir -p $(BUILDDIR)/$(PKGDIR)
24 $(BUILDDIR)/$(PKGDIR)/%.o: %.java
25 gcj -c $<
26 mv *.o $(BUILDDIR)/$(PKGDIR)
28 $(BUILDDIR)/$(PKGDIR)/_unit_test.class: _unit_test.java
29 CLASSPATH=$(CLASSPATH) $(CMD_JAVAC) $<
31 $(BUILDDIR)/$(PKGDIR)/%.class: %.java
32 CLASSPATH=$(CLASSPATH) $(CMD_JAVAC) $<
33 echo Moving `basename $@` to $(BUILDDIR)/$(PKGDIR)
34 mv `basename $@` $(BUILDDIR)/$(PKGDIR)
35 echo "Processing subclasses: $(SUBCLASSES)"
36 for i in $(SUBCLASSES) ; do test -f "$$i.class" && mv "$$i.class" $(BUILDDIR)/$(PKGDIR) ; done || true
38 run-unit-test: _unit_test.java
39 CLASSPATH=$(CLASSPATH) $(CMD_JAVAC) _unit_test.java
40 CLASSPATH=$(CLASSPATH) $(CMD_JAVAR) _unit_test
42 clean:
43 rm -f *.o *.class run-unit-test $(REAL_CLASS_FILES) $(REAL_OBJ_FILES) $(BUILDDIR)$(PACKAGE).jar