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
76
77
78
79
80
81
82
83
84
|
PROJ_DIR := ./
def : design.bin
include Makefile.util
IVFLAGS += -Iinclude/
TESTS := $(notdir \
$(shell find $(PROJ_DIR)/tests -maxdepth 1 -mindepth 1 -type d))
TEST_TARGETS := $(addprefix test_,$(TESTS))
EXAMPLES := $(notdir \
$(shell find $(PROJ_DIR)/examples -maxdepth 1 -mindepth 1 -type d))
EXAMPLE_SIM_TARGETS := $(addprefix simulate_,$(EXAMPLES))
EXAMPLE_BUILD_TARGETS := $(addprefix build_,$(EXAMPLES))
EXAMPLE_PROG_TARGETS := $(addprefix prog_,$(EXAMPLES))
design.v : design/rom.mem design/*.v design/font.mem
$(IV) $(IVFLAGS) -E $(filter %.v,$^) \
-DROM_WORDS_COUNT=$(call FILE_LINES,$<) -o $@
# Yosys synthesis (generates design.json), NextPNR routing (generates
# design.asc), bitstream generation (generates design.bin) and programming
# were moved to Makefile.util, so that they can be reused in examples.
timing.rpt : design.asc
$(ICETIME) -d hx8k -mtr $@ $<
CALL_TESTS = \
cd tests/; \
for TEST in $(1); do \
echo "** $$TEST "; \
if ! $(MAKE) -C $$TEST $(2) 3>&1 1>/dev/null 2>&3; then \
FAIL=true; \
fi; \
done; \
[ "$$FAIL" != true ]
test :
$(call CALL_TESTS,*)
# Will skip VGA tests, because they take loooong time
quicktest :
$(call CALL_TESTS,*,QUICK_TEST=1)
stack_machine_test :
$(call CALL_TESTS,stack_machine_*)
stack_machine_quicktest :
$(call CALL_TESTS,stack_machine_*,QUICK_TEST=1)
wasm_compile_test :
$(call CALL_TESTS,wasm_compile_*)
$(TEST_TARGETS) : test_% :
$(MAKE) -C tests/$*
$(EXAMPLE_SIM_TARGETS) : simulate_% :
$(MAKE) -C examples/$*
$(EXAMPLE_BUILD_TARGETS) : build_% :
$(MAKE) -C examples/$* design.bin
$(EXAMPLE_PROG_TARGETS) : prog_% :
$(MAKE) -C examples/$* prog
tools : $(TOOLS_TARGETS)
clean :
for TEST in tests/*/; do $(MAKE) -C $$TEST clean >/dev/null; done
for EXAMP in examples/*/; do $(MAKE) -C $$EXAMP clean > /dev/null; done
rm $(call FIND_GENERATED_FILES,design/) 2>/dev/null || true
$(MAKE) -C tools/ clean >/dev/null
rm $(addprefix design.,v json asc bin) timing.rpt \
$(addsuffix .log,yosys pnr) 2>/dev/null || true
.PHONY : def tools test quicktest stack_machine_test stack_machine_quicktest \
wasm_compile_test $(TEST_TARGETS) $(TOOLS_TARGETS) tools \
$(EXAMPLE_SIM_TARGETS) $(EXAMPLE_BUILD_TARGETS) $(EXAMPLE_PROG_TARGETS)
|