-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (50 loc) · 1.85 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
68
69
70
71
72
73
74
75
## Copyright 2018 Brian Swetland <[email protected]>
##
## Licensed under the Apache License, Version 2.0
## http://www.apache.org/licenses/LICENSE-2.0
#### Projects ####
include build/init.mk
help: list-all-targets
all: build-all-buildable
test: run-all-tests
$(foreach p,$(wildcard project/*.def),$(call project,$p))
clean::
rm -rf out
ALL_TARGETS := $(sort $(ALL_TARGETS)) tools cpu16-tests all
TARGET_all_DESC := build all 'build' targets
TARGET_tools_DESC := build tools: out/{a16,d16,icetool}
TARGET_cpu16-tests_DESC := run cpu16 test suite
list-all-targets::
@true
$(info All Possible Targets)
$(info --------------------)
$(foreach x,$(ALL_TARGETS),$(info $(shell printf "%-25s %s\n" "$(x)" "$(TARGET_$(x)_DESC)")))
#### Tools ####
out/a16: src/a16v5.c src/d16v5.c
@mkdir -p out
gcc -g -Wall -O1 -o out/a16 src/a16v5.c src/d16v5.c
out/d16: src/d16v5.c
@mkdir -p out
gcc -g -Wall -O1 -o out/d16 -DSTANDALONE=1 src/d16v5.c
out/udebug: src/udebug.c
@mkdir -p out
gcc -g -Wall -Wno-unused-result -O1 -o out/udebug src/udebug.c
out/icetool: src/icetool.c src/ftdi.c src/ftdi.h
@mkdir -p out
gcc -g -Wall -O1 -o out/icetool src/icetool.c src/ftdi.c -lusb-1.0 -lrt
out/crctool: src/crctool.c
@mkdir -p out
gcc -g -Wall -O1 -o out/crctool src/crctool.c
tools:: out/a16 out/d16 out/icetool out/udebug out/crctool
build-all-buildable:: $(ALL_BUILDS) tools
run-all-tests:: $(patsubst %,%-vsim,$(filter test-%,$(ALL_BUILDS)))
#### CPU16 TESTS ####
CPU16_TEST_DEPS := out/cpu16-vsim out/a16 out/d16 tests/runtest
CPU16_TESTS := $(sort $(wildcard tests/*.s))
CPU16_RESULTS := $(patsubst %.s,out/%.s.status,$(CPU16_TESTS))
out/tests/%.s.status: tests/%.s $(CPU16_TEST_DEPS)
@./tests/runtest $<
cpu16-tests: $(CPU16_RESULTS)
@echo ""
@echo TESTS FAILED: `grep FAIL out/tests/*.status | wc -l`
@echo TESTS PASSED: `grep PASS out/tests/*.status | wc -l`