makefiles #

java #

the makefiles for the things i code are usually quite simple but because i had to regularly run java programs for uni i wrote one for that, took quite a while until it worked but it finally did so here it is:

for a simple project directory structure

SRCDIR = ./src
DOCDIR = ./doc
BINDIR = ./bin
JC = javac
JI = java
JCFLAGS = -g -d $(BINDIR) -cp $(SRCDIR)
JIFLAGS = -XX\:+ShowCodeDetailsInExceptionMessages -cp $(BINDIR)
MAINCLASS = main.Main
TESTCLASS = test.MainTest
.PHONY: clean docs opendocs
# add java specific suffix rule
.SUFFIXES: .java .class

all: run

	$(JC) $(JCFLAGS) $*.java

PROGCLASSES = $(SRCDIR)/main/*.java
TESTCLASSES = $(SRCDIR)/test/*.java

compile: $(

run: clean compile

test: $(

	javadoc $(SRCDIR)/main/*.java $(SRCDIR)/vendor/*.java -d $(DOCDIR)

opendocs: docs
	python -m http.server 8005 -d $(DOCDIR) -b

	rm -rf $(BINDIR)/*