-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
67 lines (53 loc) · 1.38 KB
/
Makefile
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
59
60
61
62
63
64
65
66
67
SHELL := /bin/bash
ifneq (, $(shell which sha1sum))
SHA1 ?= sha1sum
else ifneq (, $(shell which shasum))
SHA1 ?= shasum
endif
GBFORTH = ./gbforth
export GBFORTH_PATH := $(shell pwd)/lib
LIB_FILES=lib/*.fs lib/core/*.fs
SOURCE_FILES=gbforth gbforth.fs src/*.fs src/utils/*.fs src/compiler/*.fs shared/*.fs
TEST_FILES = $(wildcard test/*.fs) $(wildcard test/*/*.fs)
TEST_OBJS = $(subst .fs,.gb,$(TEST_FILES))
EXAMPLE_OBJS = \
examples/hello-world-asm/hello.gb \
examples/hello-world/hello.gb \
examples/sokoban/sokoban.gb \
examples/simon/simon.gb \
examples/aces-up/aces-up.gb \
examples/happy-birthday/happy-birthday.gb \
examples/10-print/10-print.gb \
examples/brainfuck/brainfuck.gb \
examples/synth/synth.gb \
examples/sha256/sha256.gb
.PHONY: all examples tests
# Pattern rule to build gbforth roms
%.gb: %.fs $(SOURCE_FILES) $(LIB_FILES)
$(GBFORTH) --pad-ff $< $@
#
# Examples
#
examples/hello-world-asm/hello.gb: examples/hello-world-asm/hello.fs examples/hello-world-asm/*.fs $(SOURCE_FILES) $(LIB_FILES)
$(GBFORTH) --no-kernel $< $@
examples: $(EXAMPLE_OBJS)
#
# Tests
#
tests: $(TEST_OBJS)
check: tests examples
@cd examples/hello-world-asm/ && $(SHA1) -c hello.gb.sha
gforth src/asm.spec.fs -e bye
( cd test/; yarn test )
#
# Utils
#
clean:
-rm -f $(EXAMPLE_OBJS)
-rm -f $(TEST_OBJS)
all: examples
#
# Docker commands
#
docker-build:
docker build -t amshackers/gbforth .