Makefile: org.ibex.tool.Compiler now bootstraps itself
[org.ibex.tool.git] / Makefile
index 748de1a..f140f36 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,19 @@
-default: dist
+sources = $(shell find src -name \*.java)
+classes = $(sources:src/%.java=build/%.class)
 
-classes := ibex.tool.Preprocessor
+default: org.ibex.tool.jar
 
-sourcepath := src/java
-buildpath  := build/class
+org.ibex.tool.jar: $(classes)
+       @echo "Bootstrapping:    org.ibex.tool.jar"
+       @java -cp src:build org.ibex.tool.Compiler -j org.ibex.tool.jar -m org.ibex.tool.Compiler -v src
+       @echo "Adding resources: org.ibex.tool.jar"
+       @cd src; jar -uf ../org.ibex.tool.jar `find . -name \*.rsc -or -name \*.properties`
 
-version      := $(shell cat VERSION)
-java_sources := $(patsubst %,$(sourcepath)/%.java,$(subst .,/,$(classes)))
-java_classes := $(patsubst %,%.class,$(subst .,/,$(classes)))
+$(classes): $(sources)
+       @mkdir -p build
+       @echo "Compiling:        org.ibex.tool"
+       @javac -sourcepath java -d build -source 1.3 -target 1.1 \
+               $(sources)
 
-compile:
-       mkdir -p $(buildpath)
-       javac -sourcepath $(sourcepath) -source 1.3 -target 1.1 -d $(buildpath) \
-       $(java_sources)
-
-dist: compile
-       jar cf ibex-tool-$(version).jar -C $(buildpath) $(java_classes)
-
-clean:;        rm -rf build
+clean:
+       @rm -rf build