%.br:
	make $*.b
	make $*.r

# Build a project.
%.b: $(wildcard %/**/src/*.java)
	@ [[ -d $* ]] || (echo "Project $* does not exist." && exit 1)
	@ echo Building $*...
	javac -cp "libs/*" -d $*/bin $*/src/**/*.java

# Run a project.
%.r:
	@ [[ -d $* ]] || (echo "Project $* does not exist." && exit 1)
	@ echo Running $*...
	java -cp "libs/*":$*/bin tester.Main $*.Examples

# Clean a project.
%.clean:
	@ [[ -d $* ]] || (echo "Project $* does not exist." && exit 1)
	@ echo Cleaning $*...
	rm -f $*/bin/**/*.class
