# Build all the Java files recursively located in this directory tree.
JAVA_FILES   := $(shell find . -name '*.java' | sed "s|^\./||")
OBJ_FILES    := $(JAVA_FILES:.java=.class)

all: StringInstrumentTests ToneMatrixTests ToneMatrix

ToneMatrixTests: $(OBJ_FILES)
	echo "#!/bin/sh\njava tonematrix.ToneMatrixTests"        > ToneMatrixTests       && chmod +x ToneMatrixTests

StringInstrumentTests: $(OBJ_FILES)
	echo "#!/bin/sh\njava tonematrix.StringInstrumentTests"  > StringInstrumentTests && chmod +x StringInstrumentTests

ToneMatrix: $(OBJ_FILES)
	echo "#!/bin/sh\njava tonematrix.gui.ToneMatrixGUI \$$@"  > ToneMatrix            && chmod +x ToneMatrix

%.class: %.java
	javac $<

.PHONY: clean

clean:
	rm -f StringInstrumentTests ToneMatrixTests ToneMatrix *~ && find . -name '*.class' -delete
