# Build programs
JAVAC           = javac

# Build flags
JAVAC_FLAGS     = # -Xlint

# All the .java source files:
JAVA_SRC        := $(wildcard *.java)

# The intermediate java files and main classes we should build:
JAVA_OBJS       := $(JAVA_SRC:.java=.class)

#The test file
TEST_SRC := $(wildcard Test*.java)
TEST_CLASS := $(TEST_SRC:.java=)

%.class: %.java
	$(JAVAC) $(JAVAC_FLAGS) $<

test:: classes
	for testclass in $(TEST_CLASS); do \
	  java $$testclass; \
	done

classes::       $(JAVA_OBJS)

clean::
	rm *.class

