Add Wishbone datasheets
[AGH_computer_science_engineering_thesis.git] / Makefile
blobcad5c5fa743953f56c0a578f3678ee36e42b18dd
1 PROJ_DIR := ./
3 def : design.bin
5 include Makefile.util
7 IVFLAGS += -Iinclude/
9 TESTS := $(notdir \
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 $@ $<
33 CALL_TESTS = \
34 cd tests/; \
35 for TEST in $(1); do \
36 echo "** $$TEST "; \
37 if ! $(MAKE) -C $$TEST $(2) 3>&1 1>/dev/null 2>&3; then \
38 FAIL=true; \
39 fi; \
40 done; \
41 [ "$$FAIL" != true ]
43 test :
44 $(call CALL_TESTS,*)
46 # Will skip VGA tests, because they take loooong time
47 quicktest :
48 $(call CALL_TESTS,*,QUICK_TEST=1)
50 stack_machine_test :
51 $(call CALL_TESTS,stack_machine_*)
53 stack_machine_quicktest :
54 $(call CALL_TESTS,stack_machine_*,QUICK_TEST=1)
56 wasm_compile_test :
57 $(call CALL_TESTS,wasm_compile_*)
59 $(TEST_TARGETS) : test_% :
60 $(MAKE) -C tests/$*
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)
74 clean :
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)