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 #--------------------------------------------------------------------
43 #--------------------------------------------------------------------
45 #--------------------------------------------------------------------
47 HOST_OPTS
= -std
=gnu99
-DPREALLOCATE
=0 -DHOST_DEBUG
=1
48 HOST_COMP
= gcc
$(HOST_OPTS
)
50 RISCV_PREFIX ?
= riscv64-unknown-elf-
51 RISCV_GCC ?
= $(RISCV_PREFIX
)gcc
52 RISCV_GCC_OPTS ?
= -fpie
-static
-std
=gnu99
-O2
-ffast-math
-fno-common
-fno-builtin-printf
53 RISCV_LINK ?
= $(RISCV_GCC
) -T
$(src_dir
)/common
/test.
ld $(incs
)
54 RISCV_LINK_MT ?
= $(RISCV_GCC
) -T
$(src_dir
)/common
/test-mt.
ld
55 RISCV_LINK_OPTS ?
= -nostdlib
-nostartfiles
-ffast-math
-lgcc
56 RISCV_OBJDUMP ?
= $(RISCV_PREFIX
)objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.data
59 VPATH
+= $(addprefix $(src_dir
)/, $(bmarks
))
60 VPATH
+= $(src_dir
)/common
62 incs
+= -I
$(src_dir
)/..
/env
-I
$(src_dir
)/common
$(addprefix -I
$(src_dir
)/, $(bmarks
))
65 include $(patsubst %, $(src_dir
)/%/bmark.mk
, $(bmarks
))
67 #------------------------------------------------------------
68 # Build and run benchmarks on riscv simulator
70 bmarks_riscv_bin
= $(addsuffix .riscv
, $(bmarks
))
71 bmarks_riscv_dump
= $(addsuffix .riscv.dump
, $(bmarks
))
72 bmarks_riscv_out
= $(addsuffix .riscv.out
, $(bmarks
))
74 bmarks_defs
= -DPREALLOCATE
=1 -DHOST_DEBUG
=0
77 $(bmarks_riscv_dump
): %.riscv.dump
: %.riscv
78 $(RISCV_OBJDUMP
) $< > $@
80 $(bmarks_riscv_out
): %.riscv.out
: %.riscv
84 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
88 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) -D__ASSEMBLY__
=1 \
91 riscv
: $(bmarks_riscv_dump
)
92 run-riscv
: $(bmarks_riscv_out
)
93 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
94 $(bmarks_riscv_out
); echo
;
96 junk
+= $(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(bmarks_riscv_hex
) $(bmarks_riscv_out
)
98 #------------------------------------------------------------
99 # Build and run benchmarks on host machine
101 bmarks_host_bin
= $(addsuffix .host
, $(bmarks_host
))
102 bmarks_host_out
= $(addsuffix .host.out
, $(bmarks_host
))
104 $(bmarks_host_out
): %.host.out
: %.host
107 host
: $(bmarks_host_bin
)
108 run-host
: $(bmarks_host_out
)
109 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
110 $(bmarks_host_out
); echo
;
112 junk
+= $(bmarks_host_bin
) $(bmarks_host_out
)
114 #------------------------------------------------------------
119 #------------------------------------------------------------
122 date_suffix
= $(shell date
+%Y-
%m-
%d_
%H-
%M
)
123 install_dir
= $(instbasedir
)/$(instname
)-$(date_suffix
)
124 latest_install
= $(shell ls
-1 -d
$(instbasedir
)/$(instname
)* | tail
-n
1)
128 cp
-r
$(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(install_dir
)
131 rm -rf
$(instbasedir
)/$(instname
)
132 ln
-s
$(latest_install
) $(instbasedir
)/$(instname
)
134 #------------------------------------------------------------
138 rm -rf
$(objs
) $(junk
)