benchmarks initial commit
[riscv-tests.git] / benchmarks / spmv / bmark.mk
diff --git a/benchmarks/spmv/bmark.mk b/benchmarks/spmv/bmark.mk
new file mode 100644 (file)
index 0000000..5ab9cc0
--- /dev/null
@@ -0,0 +1,29 @@
+#=======================================================================
+# UCB CS250 Makefile fragment for benchmarks
+#-----------------------------------------------------------------------
+#
+# Each benchmark directory should have its own fragment which
+# essentially lists what the source files are and how to link them
+# into an riscv and/or host executable. All variables should include
+# the benchmark name as a prefix so that they are unique.
+#
+
+spmv_c_src = \
+       spmv_main.c \
+
+spmv_riscv_src = \
+       crt.S \
+
+spmv_c_objs     = $(patsubst %.c, %.o, $(spmv_c_src))
+spmv_riscv_objs = $(patsubst %.S, %.o, $(spmv_riscv_src))
+
+spmv_host_bin = spmv.host
+$(spmv_host_bin) : $(spmv_c_src)
+       $(HOST_COMP) $^ -o $(spmv_host_bin)
+
+spmv_riscv_bin = spmv.riscv
+$(spmv_riscv_bin) : $(spmv_c_objs) $(spmv_riscv_objs)
+       $(RISCV_LINK) $(spmv_c_objs) $(spmv_riscv_objs) -o $(spmv_riscv_bin)
+
+junk += $(spmv_c_objs) $(spmv_riscv_objs) \
+        $(spmv_host_bin) $(spmv_riscv_bin)