summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: e3e03b0322d2035ec769c7cad25134dcc2f7230d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# project classes configuration
MAINCLASS := subconscious.Subconscious

# debug or release mode
DEBUG=1
LIMIT_RAM=1

# java compiler configuraton
JAVAC := javac
JAVAC_ARGS := -Xlint:all -Xdiags:verbose \
				-sourcepath src

# java debugger configuration
JDB := jdb
JDB_ARGS := -attach jdbconn
USE_JDB := 0

# java runtime configuration
JAVA := java
JAVA_ARGS :=
ifeq ($(LIMIT_RAM),1)
	JAVA_ARGS += -Xmx2G
endif
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 jar classes dirs clean
all: subconscious libjtmx

libjtmx: dirs
	$(JAVAC) $(JAVAC_ARGS) -d build $(shell find src/libjtmx -iname '*.java')

subconscious: dirs
	$(JAVAC) $(JAVAC_ARGS) -d build $(shell find src/subconscious -iname '*.java')
	# copy resources folder
	cp -r src/subconscious/res build/subconscious/

.ONESHELL:
run: classes
	cd build
	$(JAVA) $(JAVA_ARGS) $(MAINCLASS)

.ONESHELL:
jar: classes
	cd build
	jar cfm subconscious.jar ../manifest.txt `find . -type f`

dirs:
	mkdir -p build

clean:
	rm -rd build