-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (51 loc) · 1.87 KB
/
Makefile
File metadata and controls
75 lines (51 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#=======================================================================
# Makefile for vector benchmarks
#-----------------------------------------------------------------------
XLEN ?= 64
default: all
src_dir = .
#--------------------------------------------------------------------
# Sources
#--------------------------------------------------------------------
bmarks = \
Dot \
Dot-Error \
Dot-MZ \
Dot-Fix \
#--------------------------------------------------------------------
# Build rules
#--------------------------------------------------------------------
VECTOR_GCC ?= g++
VECTOR_GCC_OPTS ?= -DPREALLOCATE=1 -ggdb -ffast-math -fno-common -fno-builtin-printf -Wall
VECTOR_LINK ?= $(RISCV_GCC) $(incs)
VECTOR_LINK_OPTS ?= -lm
VECTOR_SIM ?=
incs += -I$(src_dir)/common $(addprefix -I$(src_dir)/, $(bmarks))
objs :=
define compile_template
$(1).bin: $(wildcard $(src_dir)/$(1)/*) $(wildcard $(src_dir)/common/*)
$$(VECTOR_GCC) $$(incs) $$(VECTOR_GCC_OPTS) -o $$@ $(wildcard $(src_dir)/$(1)/*.cpp) $(wildcard $(src_dir)/common/*.cpp) $$(VECTOR_LINK_OPTS)
endef
$(foreach bmark,$(bmarks),$(eval $(call compile_template,$(bmark))))
#------------------------------------------------------------
# Build and run benchmarks on riscv simulator
bmarks_vector_bin = $(addsuffix .bin, $(bmarks))
bmarks_vector_out = $(addsuffix .vector.out, $(bmarks))
$(bmarks_vector_out): %.vector.out: %.bin
./$<
# 2> $@
run: $(bmarks_riscv_out)
junk += $(bmarks_vector_bin) $(bmarks_vector_hex) $(bmarks_vector_out)
#------------------------------------------------------------
# Default
all: $(bmarks_vector_bin)
#------------------------------------------------------------
# Install
#------------------------------------------------------------
# Clean up
clean:
rm -rf $(bmarks_vector_out)
rm -rf $(bmarks_vector_bin)
veryclean:
rm -rf $(objs) $(junk)
.PHONY: $(bmarks_riscv_out)