-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
196 lines (175 loc) · 5.85 KB
/
Copy pathMakefile
File metadata and controls
196 lines (175 loc) · 5.85 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
CC ?= gcc
# -DSOFTFLOAT_FAST_INT64 matches the flag the SoftFloat archive is built with,
# exposing the value-based f128_*/c128_* ops the quad-complex routines use.
CFLAGS = -DSOFTFLOAT_FAST_INT64 -Iinclude -ISoftFloat/source/include -Imunit -Itests/blas/include
# Pick the SoftFloat build per host OS. The Linux archive links with GNU ld's
# `-l:softfloat.a`; macOS (BSD ld) has no `-l:` form, so link the archive by
# path. Build the macOS archive first with tools/build_softfloat_darwin.sh
# (CI does this; see .github/workflows/ci.yml).
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SOFTFLOAT_DIR = SoftFloat/build/Darwin-$(shell uname -m)-clang
LDFLAGS =
LIBS = $(SOFTFLOAT_DIR)/softfloat.a
else
SOFTFLOAT_DIR = SoftFloat/build/Linux-x86_64-GCC
LDFLAGS = -L$(SOFTFLOAT_DIR)/
LIBS = -l:softfloat.a
endif
MUNIT_SRC = munit/munit.c
MUNIT_OBJ = $(MUNIT_SRC:.c=.o)
BLAS_SRC_DIR_L1 = ./src/blas/level1
BLAS_SRC_DIR_L2 = ./src/blas/level2
BLAS_SRC_DIR_L3 = ./src/blas/level3
BLAS_SRCS = \
$(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)/saxpy.c \
$(BLAS_SRC_DIR_L1)/daxpy.c \
$(BLAS_SRC_DIR_L1)/haxpy.c \
$(BLAS_SRC_DIR_L1)/qaxpy.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)/sdot.c \
$(BLAS_SRC_DIR_L1)/ddot.c \
$(BLAS_SRC_DIR_L1)/hdot.c \
$(BLAS_SRC_DIR_L1)/qdot.c \
$(BLAS_SRC_DIR_L1)/sdsdot.c \
$(BLAS_SRC_DIR_L1)/hsdot.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)/snrm2_B.c \
$(BLAS_SRC_DIR_L1)/dnrm2_B.c \
$(BLAS_SRC_DIR_L1)/hnrm2_B.c \
$(BLAS_SRC_DIR_L1)/qnrm2_B.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 \
$(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RCS:.c=.o)
TEST_SRC_DIR_L1 = ./tests/blas/level1
TEST_SRC_DIR_L2 = ./tests/blas/level2
TEST_SRC_DIR_L3 = ./tests/blas/level3
TEST_SRCS = $(wildcard $(TEST_SRC_DIR_L1)/*.c) \
$(wildcard $(TEST_SRC_DIR_L2)/*.c) \
$(wildcard $(TEST_SRC_DIR_L3)/*.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: $(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_L1)/%.o: $(TEST_SRC_DIR_L1)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(TEST_OBJS): $(TEST_SRC_DIR_L2)/%.o: $(TEST_SRC_DIR_L2)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(TEST_OBJS): $(TEST_SRC_DIR_L3)/%.o: $(TEST_SRC_DIR_L3)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(TEST_ALL_OBJ): $(TEST_ALL_SRC)
$(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)