initial commit
[riscv-tests.git] / isa / rv64si / Makefile
1 #=======================================================================
2 # Makefile for riscv-tests
3 #-----------------------------------------------------------------------
4
5 default: all
6
7 #--------------------------------------------------------------------
8 # Sources
9 #--------------------------------------------------------------------
10
11 rv64si_sc_tests = \
12 coreid \
13
14 rv64si_mc_tests = \
15 ipi \
16
17 rv64si_sc_vec_tests = \
18
19 #--------------------------------------------------------------------
20 # Build rules
21 #--------------------------------------------------------------------
22
23 RISCV_GCC = riscv-gcc
24 RISCV_GCC_OPTS = -nostdlib -nostartfiles
25 RISCV_OBJDUMP = riscv-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.data --section=.bss
26 RISCV_SIM = riscv-isa-run
27
28 #------------------------------------------------------------
29 # Build assembly tests
30
31 %.hex: %
32 elf2hex 16 16384 $< > $@
33
34 %.dump: %
35 $(RISCV_OBJDUMP) $< > $@
36
37 %.out: %
38 $(RISCV_SIM) $< 2> $@
39
40 rv64si_p_tests_bin = $(addprefix rv64si-p-, $(rv64si_sc_tests))
41 rv64si_p_tests_dump = $(addsuffix .dump, $(rv64si_p_tests_bin))
42 rv64si_p_tests_hex = $(addsuffix .hex, $(rv64si_p_tests_bin))
43 rv64si_p_tests_out = $(addsuffix .out, $(rv64si_p_tests_bin))
44
45 $(rv64si_p_tests_bin): rv64si-p-%: %.S
46 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/p -I../macros/scalar -T../../env/p/link.ld $< -o $@
47
48 rv64si_pm_tests_bin = $(addprefix rv64si-pm-, $(rv64si_mc_tests))
49 rv64si_pm_tests_dump = $(addsuffix .dump, $(rv64si_pm_tests_bin))
50 rv64si_pm_tests_hex = $(addsuffix .hex, $(rv64si_pm_tests_bin))
51 rv64si_pm_tests_out = $(addsuffix .out, $(rv64si_pm_tests_bin))
52
53 $(rv64si_pm_tests_bin): rv64si-pm-%: %.S
54 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/pm -I../macros/scalar -T../../env/pm/link.ld $< -o $@
55
56 rv64si_p_vec_tests_bin = $(addprefix rv64si-p-vec-, $(rv64si_sc_vec_tests))
57 rv64si_p_vec_tests_dump = $(addsuffix .dump, $(rv64si_p_vec_tests_bin))
58 rv64si_p_vec_tests_hex = $(addsuffix .hex, $(rv64si_p_vec_tests_bin))
59 rv64si_p_vec_tests_out = $(addsuffix .out, $(rv64si_p_vec_tests_bin))
60
61 $(rv64si_p_vec_tests_bin): rv64si-p-vec-%: %.S
62 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/p -I../macros/vector -T../../env/p/link.ld $< -o $@
63
64 rv64si_pt_vec_tests_bin = $(addprefix rv64si-pt-vec-, $(rv64si_sc_vec_tests))
65 rv64si_pt_vec_tests_dump = $(addsuffix .dump, $(rv64si_pt_vec_tests_bin))
66 rv64si_pt_vec_tests_hex = $(addsuffix .hex, $(rv64si_pt_vec_tests_bin))
67 rv64si_pt_vec_tests_out = $(addsuffix .out, $(rv64si_pt_vec_tests_bin))
68
69 $(rv64si_pt_vec_tests_bin): rv64si-pt-vec-%: %.S
70 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/pt -I../macros/vector -T../../env/pt/link.ld $< -o $@
71
72 riscv-: \
73 $(rv64si_p_tests_dump) $(rv64si_p_tests_hex) \
74 $(rv64si_pm_tests_dump) $(rv64si_pm_tests_hex) \
75 $(rv64si_p_vec_tests_dump) $(rv64si_p_vec_tests_hex) \
76 $(rv64si_pt_vec_tests_dump) $(rv64si_pt_vec_tests_hex) \
77
78 out = $(rv64si_p_tests_out) $(rv64si_pm_tests_out) $(rv64si_p_vec_tests_out)
79
80 run: $(out)
81 echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
82 $(out); echo;
83
84 junk += \
85 $(rv64si_p_tests_bin) $(rv64si_p_tests_dump) $(rv64si_p_tests_hex) $(rv64si_p_tests_out) \
86 $(rv64si_pm_tests_bin) $(rv64si_pm_tests_dump) $(rv64si_pm_tests_hex) $(rv64si_pm_tests_out) \
87 $(rv64si_p_vec_tests_bin) $(rv64si_p_vec_tests_dump) $(rv64si_p_vec_tests_hex) $(rv64si_p_vec_tests_out) \
88 $(rv64si_pt_vec_tests_bin) $(rv64si_pt_vec_tests_dump) $(rv64si_pt_vec_tests_hex) $(rv64si_pt_vec_tests_out) \
89
90 #------------------------------------------------------------
91 # Default
92
93 all: riscv-
94
95 #------------------------------------------------------------
96 # Clean up
97
98 clean:
99 rm -rf $(junk)