# project classes configuration MAINCLASS := subconscious.Subconscious SOURCES := $(shell find src -iname '*.java') # debug or release mode DEBUG=1 # java compiler configuraton JAVAC := javac JAVAC_ARGS := -Xlint:all \ -classpath lib/gson-2.6.2.jar:. \ -sourcepath src # java debugger configuration JDB := jdb JDB_ARGS := -attach jdbconn USE_JDB := 0 # java runtime configuration JAVA := java JAVA_ARGS := -cp ../lib/gson-2.6.2.jar:. -Xmx2G ifeq ($(USE_JDB),1) JAVA_ARGS += -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 endif ifeq ($(DEBUG),1) JAVA_ARGS += -enableassertions endif # recipes .PHONY: all run pack classes dirs clean all: classes classes: dirs $(JAVAC) $(JAVAC_ARGS) -d build $(SOURCES) .ONESHELL: run: classes cd build $(JAVA) $(JAVA_ARGS) $(MAINCLASS) .ONESHELL: pack: classes echo "Main-Class: $(MAINCLASS)" > jar/manifest.txt jar cvfm jar/$(MAINCLASS).jar jar/manifest.txt -C bin/ . rm jar/manifest.txt cp lib/gson-2.6.2.jar jar/ cd jar jar xf gson-2.6.2.jar rm META-INF -R jar xf Sub.jar rm gson-2.6.2.jar rm Sub.jar zip -r Subconcious.jar ./* find . ! -name 'Subconcious.jar' -type f -exec rm -f {} + rm -R com META-INF dirs: mkdir -p build clean: rm -rd build