f8db5b95e6315a499c7894337160ca1955c7e174
1 #=======================================================================
2 # UCB VLSI FLOW: Makefile for riscv-bmarks
3 #-----------------------------------------------------------------------
4 # Yunsup Lee (yunsup@cs.berkeley.edu)
11 instname
= riscv-bmarks
12 instbasedir
= $(UCB_VLSI_HOME
)/install
14 #--------------------------------------------------------------------
16 #--------------------------------------------------------------------
47 #--------------------------------------------------------------------
49 #--------------------------------------------------------------------
51 HOST_OPTS
= -std
=gnu99
-DPREALLOCATE
=0 -DHOST_DEBUG
=1
52 HOST_COMP
= gcc
$(HOST_OPTS
)
55 RISCV_GCC_OPTS
= -static
-Wa
,-march
=RVIMAFDXhwacha
-std
=gnu99
-O2
-ffast-math
56 RISCV_LINK
= riscv-gcc
-T
$(bmarkdir
)/common
/test.
ld $(incs
)
57 RISCV_LINK_MT
= riscv-gcc
-T
$(bmarkdir
)/common
/test-mt.
ld
58 RISCV_LINK_OPTS
= -nostdlib
-nostartfiles
-ffast-math
-lc
59 RISCV_OBJDUMP
= riscv-objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.data
62 VPATH
+= $(addprefix $(bmarkdir
)/, $(bmarks
))
63 VPATH
+= $(bmarkdir
)/common
65 incs
+= -I
$(bmarkdir
)/..
/env
-I
$(bmarkdir
)/common
$(addprefix -I
$(bmarkdir
)/, $(bmarks
))
68 include $(patsubst %, $(bmarkdir
)/%/bmark.mk
, $(bmarks
))
70 #------------------------------------------------------------
71 # Build and run benchmarks on riscv simulator
73 bmarks_riscv_bin
= $(addsuffix .riscv
, $(bmarks
))
74 bmarks_riscv_dump
= $(addsuffix .riscv.dump
, $(bmarks
))
75 bmarks_riscv_hex
= $(addsuffix .riscv.hex
, $(bmarks
))
76 bmarks_riscv_out
= $(addsuffix .riscv.out
, $(bmarks
))
78 bmarks_defs
= -DPREALLOCATE
=1 -DHOST_DEBUG
=0
82 elf2hex
16 32768 $< > $@
84 $(bmarks_riscv_dump
): %.riscv.dump
: %.riscv
85 $(RISCV_OBJDUMP
) $< > $@
87 $(bmarks_riscv_out
): %.riscv.out
: %.riscv
91 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
95 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) -D__ASSEMBLY__
=1 \
98 riscv
: $(bmarks_riscv_dump
) $(bmarks_riscv_hex
)
99 run-riscv
: $(bmarks_riscv_out
)
100 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
101 $(bmarks_riscv_out
); echo
;
103 junk
+= $(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(bmarks_riscv_hex
) $(bmarks_riscv_out
)
105 #------------------------------------------------------------
106 # Build and run benchmarks on host machine
108 bmarks_host_bin
= $(addsuffix .host
, $(bmarks_host
))
109 bmarks_host_out
= $(addsuffix .host.out
, $(bmarks_host
))
111 $(bmarks_host_out
): %.host.out
: %.host
114 host
: $(bmarks_host_bin
)
115 run-host
: $(bmarks_host_out
)
116 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
117 $(bmarks_host_out
); echo
;
119 junk
+= $(bmarks_host_bin
) $(bmarks_host_out
)
121 #------------------------------------------------------------
126 #------------------------------------------------------------
129 date_suffix
= $(shell date
+%Y-
%m-
%d_
%H-
%M
)
130 install_dir
= $(instbasedir
)/$(instname
)-$(date_suffix
)
131 latest_install
= $(shell ls
-1 -d
$(instbasedir
)/$(instname
)* | tail
-n
1)
135 cp
-r
$(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(install_dir
)
138 rm -rf
$(instbasedir
)/$(instname
)
139 ln
-s
$(latest_install
) $(instbasedir
)/$(instname
)
141 #------------------------------------------------------------
145 rm -rf
$(objs
) $(junk
)