aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 3fae2a7113af6554884bb77004e2e9e5c9c7d985 (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
.DEFAULT_GOAL := engine

# Modules listed in dependency order
MODULE_NAMES := entity tilemap world input physics renderer
OBJECT_FILES := $(patsubst %,bin/%.o,$(MODULE_NAMES))

# Build all engine modules
engine: $(OBJECT_FILES)

bin:
	@mkdir -p $@

downstroke:
	@mkdir -p $@

# Explicit inter-module dependencies
bin/entity.o:
bin/tilemap.o:
bin/world.o: bin/entity.o bin/tilemap.o
bin/input.o: bin/entity.o
bin/physics.o: bin/entity.o bin/world.o bin/tilemap.o
bin/renderer.o: bin/entity.o bin/tilemap.o bin/world.o

# Pattern rule: compile each module as a library unit
bin/%.o: %.scm | bin downstroke
	csc -c -J -unit downstroke/$* $*.scm -o bin/$*.o -I bin -L bin/downstroke
	@mkdir -p bin/downstroke && if [ -f downstroke/$*.import.scm ]; then mv downstroke/$*.import.scm bin/downstroke/; fi

.PHONY: clean test engine demos

clean:
	rm -rf bin
	rm -f *.import.scm
	rm -f *.log

test:
	@echo "Running unit tests..."
	@csi -s tests/entity-test.scm
	@csi -s tests/world-test.scm
	@csi -s tests/tilemap-test.scm
	@csi -s tests/physics-test.scm
	@csi -s tests/input-test.scm
	@csi -s tests/renderer-test.scm

demos:
	@echo "No demos yet."