1 #=======================================================================
2 # UCB VLSI FLOW: Makefile for riscv-bmarks/mt
3 #-----------------------------------------------------------------------
4 # Henry Cook (hcook@cs.berkeley.edu)
11 instname
= riscv-bmarks-mt
12 instbasedir
= $(UCB_VLSI_HOME
)/install
14 #--------------------------------------------------------------------
16 #--------------------------------------------------------------------
86 #--------------------------------------------------------------------
88 #--------------------------------------------------------------------
91 RISCV_GCC_OPTS
= -std
=gnu99
-T common
/test.
ld -O3
-nostdlib
-nostartfiles
-funroll-all-loops
92 RISCV_LINK
= riscv-gcc
-T
$(bmarkdir
)/common
/test.
ld
93 RISCV_LINK_MT
= riscv-gcc
-T
$(bmarkdir
)/common
/test-mt.
ld
95 RISCV_LINK_SYSCALL
= $(bmarkdir
)/common
/syscalls.c
-lc
96 RISCV_OBJDUMP
= riscv-objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.data
99 VPATH
+= $(addprefix $(bmarkdir
)/, $(bmarks
))
100 VPATH
+= $(bmarkdir
)/common
102 incs
+= -I.
-I.
/common
$(addprefix -I
$(bmarkdir
)/, $(bmarks
))
105 #include $(patsubst %, $(bmarkdir)/%/bmark.mk, $(bmarks))
107 #------------------------------------------------------------
108 # Build and run benchmarks on riscv simulator
109 #------------------------------------------------------------
111 bmarks_riscv_obj
= $(addsuffix .o
, $(bmarks
))
112 bmarks_riscv_bin
= $(addsuffix .riscv
, $(bmarks
))
113 bmarks_riscv_dump
= $(addsuffix .riscv.dump
, $(bmarks
))
114 bmarks_riscv_hex
= $(addsuffix .riscv.hex
, $(bmarks
))
115 bmarks_riscv_out
= $(addsuffix .riscv.out
, $(bmarks
))
117 bmarks_defs
= -DPREALLOCATE
=1 -DHOST_DEBUG
=0
118 bmarks_cycles
= 80000
121 elf2hex
16 32768 $< > $@
123 $(bmarks_riscv_bin
): %.riscv
: %.o crt-mt.o
124 $(RISCV_LINK_MT
) crt-mt.o
$< $(RISCV_LINK_SYSCALL
) -o
$@
126 $(bmarks_riscv_dump
): %.riscv.dump
: %.riscv
127 $(RISCV_OBJDUMP
) $< > $@
129 $(bmarks_riscv_out
): %.riscv.out
: %.riscv
133 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
137 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
140 riscv
: $(bmarks_riscv_dump
) $(bmarks_riscv_hex
)
141 run-riscv
: $(bmarks_riscv_out
)
142 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
144 junk
+= $(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(bmarks_riscv_hex
) $(bmarks_riscv_out
)
147 #------------------------------------------------------------
152 #------------------------------------------------------------
155 date_suffix
= $(shell date
+%Y-
%m-
%d_
%H-
%M
)
156 install_dir
= $(instbasedir
)/$(instname
)-$(date_suffix
)
157 latest_install
= $(shell ls
-1 -d
$(instbasedir
)/$(instname
)* | tail
-n
1)
161 cp
-r
$(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(install_dir
)
164 rm -rf
$(instbasedir
)/$(instname
)
165 ln
-s
$(latest_install
) $(instbasedir
)/$(instname
)
167 #------------------------------------------------------------
171 rm -rf
$(objs
) $(junk
)