-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
117 lines (96 loc) · 3.28 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
CC = gcc
CFLAGS = -Iinclude -ISoftFloat/source/include
LDFLAGS = -LSoftFloat/build/Linux-x86_64-GCC/
LIBS = -l:softfloat.a
MUNIT_SRC = munit/munit.c
MUNIT_OBJ = $(MUNIT_SRC:.c=.o)
BLAS_STATE_DIR = ./src
BLAS_SRC_DIR_L1 = ./src/blas/level1
BLAS_SRC_DIR_L2 = ./src/blas/level2
BLAS_SRC_DIR_L3 = ./src/blas/level3
BLAS_SRCS = \
$(BLAS_STATE_DIR)/softblas_state.c \
$(BLAS_SRC_DIR_L1)/sasum.c \
$(BLAS_SRC_DIR_L1)/dasum.c \
$(BLAS_SRC_DIR_L1)/hasum.c \
$(BLAS_SRC_DIR_L1)/qasum.c \
$(BLAS_SRC_DIR_L1)/scasum.c \
$(BLAS_SRC_DIR_L1)/saxpy.c \
$(BLAS_SRC_DIR_L1)/daxpy.c \
$(BLAS_SRC_DIR_L1)/haxpy.c \
$(BLAS_SRC_DIR_L1)/qaxpy.c \
$(BLAS_SRC_DIR_L1)/caxpy.c \
$(BLAS_SRC_DIR_L1)/scopy.c \
$(BLAS_SRC_DIR_L1)/dcopy.c \
$(BLAS_SRC_DIR_L1)/hcopy.c \
$(BLAS_SRC_DIR_L1)/qcopy.c \
$(BLAS_SRC_DIR_L1)/ccopy.c \
$(BLAS_SRC_DIR_L1)/sdot.c \
$(BLAS_SRC_DIR_L1)/ddot.c \
$(BLAS_SRC_DIR_L1)/hdot.c \
$(BLAS_SRC_DIR_L1)/qdot.c \
$(BLAS_SRC_DIR_L1)/cdotc.c \
$(BLAS_SRC_DIR_L1)/snrm2.c \
$(BLAS_SRC_DIR_L1)/dnrm2.c \
$(BLAS_SRC_DIR_L1)/hnrm2.c \
$(BLAS_SRC_DIR_L1)/qnrm2.c \
$(BLAS_SRC_DIR_L1)/sscal.c \
$(BLAS_SRC_DIR_L1)/dscal.c \
$(BLAS_SRC_DIR_L1)/hscal.c \
$(BLAS_SRC_DIR_L1)/qscal.c \
$(BLAS_SRC_DIR_L1)/sswap.c \
$(BLAS_SRC_DIR_L1)/dswap.c \
$(BLAS_SRC_DIR_L1)/hswap.c \
$(BLAS_SRC_DIR_L1)/qswap.c \
$(BLAS_SRC_DIR_L1)/isamax.c \
$(BLAS_SRC_DIR_L1)/idamax.c \
$(BLAS_SRC_DIR_L1)/ihamax.c \
$(BLAS_SRC_DIR_L1)/iqamax.c \
$(BLAS_SRC_DIR_L2)/sgemv.c \
$(BLAS_SRC_DIR_L2)/dgemv.c \
$(BLAS_SRC_DIR_L2)/hgemv.c \
$(BLAS_SRC_DIR_L2)/qgemv.c \
$(BLAS_SRC_DIR_L3)/sgemm.c \
$(BLAS_SRC_DIR_L3)/dgemm.c \
$(BLAS_SRC_DIR_L3)/hgemm.c \
$(BLAS_SRC_DIR_L3)/qgemm.c
# $(BLAS_SRC_DIR_L1)/srotg.c
BLAS_OBJS = $(BLAS_SRCS:.c=.o)
TEST_SRC_DIR = ./tests/blas/level1
TEST_SRCS = $(wildcard $(TEST_SRC_DIR)/*.c)
TEST_OBJS = $(TEST_SRCS:.c=.o)
TEST_ALL_SRC = ./tests/test_all.c
TEST_ALL_OBJ = $(TEST_ALL_SRC:.c=.o)
# set default target to library
.DEFAULT_GOAL := library
TARGET = libsoftblas.a
TEST_TARGET = test_all
library: $(TARGET)
tests: CFLAGS += -Imunit -Itests/blas/include
tests: $(TEST_TARGET)
$(TARGET): $(BLAS_OBJS)
ar rcs $@ $^
$(TEST_TARGET): $(TEST_OBJS) $(BLAS_OBJS) $(MUNIT_OBJ) $(TEST_ALL_OBJ)
$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
$(TEST_OBJS): $(TEST_SRC_DIR)/%.o: $(TEST_SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(TEST_ALL_OBJ): $(TEST_ALL_SRC)
$(CC) $(CFLAGS) -c $< -o $@
$(BLAS_OBJS): $(BLAS_STATE_DIR)/%.o: $(BLAS_STATE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BLAS_OBJS): $(BLAS_SRC_DIR_L1)/%.o: $(BLAS_SRC_DIR_L1)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BLAS_OBJS): $(BLAS_SRC_DIR_L2)/%.o: $(BLAS_SRC_DIR_L2)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BLAS_OBJS): $(BLAS_SRC_DIR_L3)/%.o: $(BLAS_SRC_DIR_L3)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(MUNIT_OBJ): $(MUNIT_SRC)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(TEST_OBJS) $(BLAS_OBJS) $(MUNIT_OBJ) $(TEST_ALL_OBJ)
allclean:
rm -f $(TEST_OBJS) $(BLAS_OBJS) $(MUNIT_OBJ) $(TEST_ALL_OBJ) $(TEST_TARGET)
benchmark: $(BLAS_OBJS) benchmarking/benchmark_sgemm.c
$(CC) $(CFLAGS) benchmarking/benchmark_sgemm.c $(BLAS_OBJS) -o benchmark -lm $(LDFLAGS) $(LIBS)
benchmark_openblas: benchmarking/benchmark_sgemm_openblas.c
$(CC) -I/usr/include/openblas benchmarking/benchmark_sgemm_openblas.c -o benchmark_openblas -lm -lopenblas