aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 43 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..960f42e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,43 @@
+.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 $@
+
+# 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 bin/%.import.scm: %.scm | bin
+ csc -c -J -unit $* $*.scm -o bin/$*.o -I bin
+ @if [ -f $*.import.scm ]; then mv $*.import.scm bin/; 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."