To test a new program, just start writing it. When "make test-fast" is executed, the class file will be built, then run. That is, you never have to update the Makefile -- it picks up the most recent Java source file automatically.
I bind "make test-fast" to the big keypad Enter key, but that's for another blog post.
RECENT_JAVA := $(shell ls -1t *.java | head -1)
all test-fast: $(basename $(RECENT_JAVA)).test
test-all: $(patsubst %.java,%.test,$(wildcard *.java))
%.class: %.java
javac $<
%.test: %.class
env CLASSPATH=.:$(CLASSPATH) java $(basename $<)
check-syntax:
javac -Xlint $(CHK_SOURCES)
clean:
rm *.class
No comments:
Post a Comment