Makefile: build all class files in tests/
authorBernhard Urban <lewurm@gmail.com>
Mon, 2 Apr 2012 00:00:48 +0000 (02:00 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 2 Apr 2012 00:00:48 +0000 (02:00 +0200)
Makefile
Test.java [deleted file]
tests/Test.java [new file with mode: 0644]

index 08f7d2b28655bc654ef8948435a259a1afd89398..289fe3fe39708daee2d41d31055865d1c4b86928 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,9 @@
-all: mate Test.class
-       ./mate Test.class
+JAVAC = javac
+JAVA_FILES := $(wildcard tests/*.java)
+CLASS_FILES := $(JAVA_FILES:.java=.class)
+
+all: mate $(CLASS_FILES)
+       ./mate tests/Test.class
 
 %.class: %.java
        javac $<
@@ -8,4 +12,4 @@ mate: Mate.hs ./src/Utilities.hs trap.c
        ghc --make -Wall -O2 $^ -o $@
 
 clean:
-       rm -f *.hi *.o mate
+       rm -f *.hi *.o mate src/*.class
diff --git a/Test.java b/Test.java
deleted file mode 100644 (file)
index 6f557c3..0000000
--- a/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class Test {
-    private static int foo;
-    private static int bar;
-
-    public static void main(String [] args) {
-      foo = 0x42;
-      bar = 2 * foo;
-    }
-}
diff --git a/tests/Test.java b/tests/Test.java
new file mode 100644 (file)
index 0000000..6f557c3
--- /dev/null
@@ -0,0 +1,9 @@
+public class Test {
+    private static int foo;
+    private static int bar;
+
+    public static void main(String [] args) {
+      foo = 0x42;
+      bar = 2 * foo;
+    }
+}