-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (49 loc) · 1.74 KB
/
Makefile
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
# Benchmark programs for sparse matrix-vector multiply
#
# Copyright (C) 2023 James D. Trotter
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
# Authors: James D. Trotter <[email protected]>
#
# Last modified: 2023-03-08
#
# Benchmarking program for sparse matrix-vector multiplication (SpMV)
# with matrices in ELLPACK and CSR format.
csrspmv = csrspmv
ellspmv = ellspmv
all: $(csrspmv) $(ellspmv)
clean:
rm -f $(csrspmv_c_objects) $(csrspmv)
rm -f $(ellspmv_c_objects) $(ellspmv)
.PHONY: all clean
CFLAGS ?= -O2 -g -Wall
LDFLAGS ?= -lm
papi_util.o: papi_util.c papi_util.h
$(CC) -c $(CFLAGS) $< -o $@
csrspmv_c_sources = csrspmv.c
csrspmv_c_headers = papi_util.h
csrspmv_c_objects := $(foreach x,$(csrspmv_c_sources),$(x:.c=.o))
$(csrspmv_c_objects): %.o: %.c $(csrspmv_c_headers)
$(CC) -c $(CFLAGS) $< -o $@
$(csrspmv): $(csrspmv_c_objects) papi_util.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
ellspmv_c_sources = ellspmv.c
ellspmv_c_headers = papi_util.h
ellspmv_c_objects := $(foreach x,$(ellspmv_c_sources),$(x:.c=.o))
$(ellspmv_c_objects): %.o: %.c $(ellspmv_c_headers)
$(CC) -c $(CFLAGS) $< -o $@
$(ellspmv): $(ellspmv_c_objects) papi_util.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@