10 $(shell find
$(PROJ_DIR
)/tests
-maxdepth
1 -mindepth
1 -type d
))
12 TEST_TARGETS
:= $(addprefix test_
,$(TESTS
))
14 EXAMPLES
:= $(notdir \
15 $(shell find
$(PROJ_DIR
)/examples
-maxdepth
1 -mindepth
1 -type d
))
17 EXAMPLE_SIM_TARGETS
:= $(addprefix simulate_
,$(EXAMPLES
))
18 EXAMPLE_BUILD_TARGETS
:= $(addprefix build_
,$(EXAMPLES
))
19 EXAMPLE_PROG_TARGETS
:= $(addprefix prog_
,$(EXAMPLES
))
21 design.v
: design
/rom.mem design
/*.v design
/font.mem
22 $(IV
) $(IVFLAGS
) -E
$(filter %.v
,$^
) \
23 -DROM_WORDS_COUNT
=$(call FILE_LINES
,$<) -o
$@
25 # Yosys synthesis (generates design.json), NextPNR routing (generates
26 # design.asc), bitstream generation (generates design.bin) and programming
27 # were moved to Makefile.util, so that they can be reused in examples.
29 timing.rpt
: design.asc
30 $(ICETIME
) -d hx8k
-mtr
$@
$<
35 for TEST in
$(1); do \
37 if
! $(MAKE
) -C
$$TEST $(2) 3>&1 1>/dev
/null
2>&3; then \
46 # Will skip VGA tests, because they take loooong time
48 $(call CALL_TESTS
,*,QUICK_TEST
=1)
51 $(call CALL_TESTS
,stack_machine_
*)
53 stack_machine_quicktest
:
54 $(call CALL_TESTS
,stack_machine_
*,QUICK_TEST
=1)
57 $(call CALL_TESTS
,wasm_compile_
*)
59 $(TEST_TARGETS
) : test_
% :
62 $(EXAMPLE_SIM_TARGETS
) : simulate_
% :
63 $(MAKE
) -C examples
/$*
65 $(EXAMPLE_BUILD_TARGETS
) : build_
% :
66 $(MAKE
) -C examples
/$* design.bin
68 $(EXAMPLE_PROG_TARGETS
) : prog_
% :
69 $(MAKE
) -C examples
/$* prog
72 tools
: $(TOOLS_TARGETS
)
75 for TEST in tests
/*/; do
$(MAKE
) -C
$$TEST clean >/dev
/null
; done
76 for EXAMP in examples
/*/; do
$(MAKE
) -C
$$EXAMP clean > /dev
/null
; done
77 rm $(call FIND_GENERATED_FILES
,design
/) 2>/dev
/null || true
78 $(MAKE
) -C tools
/ clean >/dev
/null
79 rm $(addprefix design.
,v json asc bin
) timing.rpt \
80 $(addsuffix .log
,yosys pnr
) 2>/dev
/null || true
82 .PHONY
: def tools
test quicktest stack_machine_test stack_machine_quicktest \
83 wasm_compile_test
$(TEST_TARGETS
) $(TOOLS_TARGETS
) tools \
84 $(EXAMPLE_SIM_TARGETS
) $(EXAMPLE_BUILD_TARGETS
) $(EXAMPLE_PROG_TARGETS
)