It seems the solution I arrived at after my last question didn't
completely do the trick.
I now have this:
----
CLASSPATH := .:/usr/share/java/junit.jar
JAVAC := javac -classpath $(CLASSPATH)
JUNIT := java -classpath $(CLASSPATH) junit.textui.TestRunner
CLASSES := BetterTray.class BinTree.class BinTree2.class Queue.class
TESTCLASSES := $(CLASSES:%=Test%)
all: $(CLASSES)
BinTree.class: Queue.class
BinTree2.class: BetterTray.class
%.class: %.java
$(JAVAC) $<
test: $(TESTCLASSES)
$(TESTCLASSES): Test%: %
$(JUNIT) $(patsubst %.class,%,$@)
.PHONY: clean
clean:
rm -f $(CLASSES) $(CLASSES:%=Test%)
----
Now, if I run 'make test', make will start out building
BetterTray.class, like it should, and then go on to run $(JUNIT) on
TestBetterTray.class. So, what's missing is that it doesn't actually
build TestBetterTray.class in between those steps. How would I make the
$(TESTCLASSES): Test%: %
rule also depend on the build rule for the corresponding test class?
(The %.class: %.java rule.)
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make