forked from scoopr/vectorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
294 lines (247 loc) · 10.7 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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
CXX?=g++
CLANG_CC=clang
CLANG_CXX=clang++
IPHONE_PLATFORM_PATH = /Developer/Platforms/iPhoneOS.platform/Developer
IPHONE_ISYSROOT_PATH = $(IPHONE_PLATFORM_PATH)/SDKs/iPhoneOS4.2.sdk/
IPHONE_CC = $(IPHONE_PLATFORM_PATH)/usr/bin/g++ -isysroot $(IPHONE_ISYSROOT_PATH) -arch armv7
# -mfloat-abi=softfp -mfpu=neon
#CXXFLAGS += -Iinclude -O0
#CXXFLAGS += -g -Iinclude -Wall -Wextra -pedantic -Wno-unused -O3 -fstrict-aliasing -Wstrict-aliasing=2 -ffast-math
CXXFLAGS += -Iinclude -Wall -Wextra -pedantic -Wno-unused -O3 -fstrict-aliasing -Wstrict-aliasing=2 -ffast-math -D__extern_always_inline=inline
SPEC_SRC = $(wildcard spec/*.cpp)
SPEC_OBJ = $(SPEC_SRC:.cpp=.o)
BENCH_SRC = $(wildcard bench/*.cpp)
BENCH_OBJ = $(BENCH_SRC:.cpp=.o)
BENCH_ASM = $(patsubst %.cpp,asm$(SUFFIX)/%.S,$(BENCH_SRC))
SUFFIX=
DEFAULT_CC=1
ifeq ($(FORCE_SCALAR),1)
CXXFLAGS+= -DVECTORIAL_FORCED -DVECTORIAL_SCALAR
SUFFIX=-scalar
endif
ifeq ($(FORCE_SSE),1)
CXXFLAGS+= -DVECTORIAL_FORCED -DVECTORIAL_SSE -msse -msse2 -mfpmath=sse
SUFFIX=-sse
endif
ifeq ($(FORCE_GNU),1)
CXXFLAGS+= -DVECTORIAL_FORCED -DVECTORIAL_GNU
#-msse -msse2 -mfpmath=sse
SUFFIX=-gnu
endif
ifeq ($(FORCE_NEON),1)
CXXFLAGS+= -DVECTORIAL_FORCED -DVECTORIAL_NEON
SUFFIX=-neon
ARM=1
endif
ifeq ($(ARM),1)
ifeq ($(shell uname -s),Darwin)
CC=$(IPHONE_CC)
CXX=$(IPHONE_CC)
endif
# CXXFLAGS+= -mcpu=cortex-a8
CXXFLAGS+= -mno-thumb -mfloat-abi=softfp -mfpu=neon
DEFAULT_CC=0
endif
ifeq ($(CLANG),1)
CC=$(CLANG_CC)
CXX=$(CLANG_CXX)
DEFAULT_CC=0
endif
ifeq ($(DEFAULT_CC),1)
# CXXFLAGS += -msse -msse2 -mfpmath=sse
endif
ifeq ($(ASM),1)
CC+= -S
CXX+= -S
endif
BUILDDIR=build$(SUFFIX)
SPEC_OBJ := $(addprefix $(BUILDDIR)/,$(SPEC_OBJ))
BENCH_OBJ := $(addprefix $(BUILDDIR)/,$(BENCH_OBJ))
SILENT=@
MKDIR=mkdir -p
PATH_SEPARATOR=/
$(BUILDDIR)/%.o: %.cpp
@echo CXX $<
$(SILENT) $(MKDIR) $(subst /,$(PATH_SEPARATOR),$(dir $@))
$(SILENT) $(COMPILE.cc) -o $@ $<
.PHONY: all
all: specsuite$(SUFFIX)
./specsuite$(SUFFIX)
.PHONY: full
full:
@clear
@echo FULL COMPILE at `date +%H:%M:%S`
# FORCE_SCALAR=1 $(MAKE) clean
@FORCE_SCALAR=1 $(MAKE) specsuite-scalar
# FORCE_GNU=1 $(MAKE) clean
@FORCE_GNU=1 $(MAKE) specsuite-gnu
# FORCE_SSE=1 $(MAKE) clean
@FORCE_SSE=1 $(MAKE) specsuite-sse
# FORCE_NEON=1 $(MAKE) clean
# FORCE_NEON=1 $(MAKE) specsuite-neon
@./specsuite-scalar
@./specsuite-sse
@./specsuite-gnu
specsuite$(SUFFIX): $(SPEC_OBJ)
@echo LINK $@
@$(CXX) $(LDFLAGS) $^ -o $@
.PHONY: depend
depend:
@echo DEP
@makedepend -Y -- $(CXXFLAGS) -- $(SPEC_SRC) $(BENCH_SRC) -p$(BUILDDIR)/ > /dev/null 2>&1
@$(RM) Makefile.bak
define asm-command
@mkdir -p $(dir asm$(SUFFIX)/$(1))
$(CXX) $(CXXFLAGS) -S $(1) -o asm$(SUFFIX)/$(1).S
endef
bench-asm: $(BENCH_SRC)
$(foreach p,$(BENCH_SRC),$(call asm-command,$(p)))
benchmark$(SUFFIX): $(BENCH_OBJ) bench-asm
$(CXX) $(BENCH_OBJ) -o $@
.PHONY: bench-full
bench-full:
FORCE_SCALAR=1 $(MAKE) benchmark-scalar
FORCE_GNU=1 $(MAKE) benchmark-gnu
FORCE_SSE=1 $(MAKE) benchmark-sse
# FORCE_NEON=1 $(MAKE) clean
# FORCE_NEON=1 $(MAKE) benchmark-neon
./benchmark-scalar
./benchmark-sse
./benchmark-gnu
.PHONY: clean
clean:
rm -f $(SPEC_OBJ) $(BENCH_OBJ) benchmark$(SUFFIX) specsuite$(SUFFIX)
rm -rf asm$(SUFFIX)
.PHONY: realclean
realclean: clean
rm -f specsuite*
rm -rf build*
.PHONY: update_spec
update_spec:
./tools/update_spec.rb spec/spec_*.cpp
ifeq ($(MAKECMDGOALS),export)
ifeq ($(origin to),undefined)
$(error to not set, like make export to=/foo/bar)
endif
endif
.PHONY: export
export:
$(SILENT) git archive --format tar master | tar x -C $(to)
include/vectorial/vec2f.h include/vectorial/vec3f.h include/vectorial/vec4f.h: include/vectorial/simd4f.h
include/vectorial/simd4f.h: include/vectorial/simd4f_scalar.h
include/vectorial/simd4f.h: include/vectorial/simd4f_neon.h
include/vectorial/simd4f.h: include/vectorial/simd4f_gnu.h
include/vectorial/simd4f.h: include/vectorial/simd4f_sse.h
include/vectorial/simd4f.h: include/vectorial/simd4f_scalar.h
include/vectorial/simd4f.h: include/vectorial/config.h
include/vectorial/simd4x4f.h: include/vectorial/simd4f.h
include/vectorial/simd4x4f.h: include/vectorial/simd4x4f_scalar.h
include/vectorial/simd4x4f.h: include/vectorial/simd4x4f_neon.h
include/vectorial/simd4x4f.h: include/vectorial/simd4x4f_gnu.h
include/vectorial/simd4x4f.h: include/vectorial/simd4x4f_sse.h
include/vectorial/simd4x4f.h: include/vectorial/config.h
spec/spec_helper.h: include/vectorial/simd4x4f.h include/vectorial/simd4f.h include/vectorial/vec4f.h include/vectorial/vec3f.h include/vectorial/vec2f.h
spec/spec.cpp: spec/spec.h
spec/spec_main.cpp: spec/spec.h
spec/spec_simd4f.cpp: spec/spec_helper.h
spec/spec_simd4x4f.cpp: spec/spec_helper.h
spec/spec_vec2f.cpp: spec/spec_helper.h
spec/spec_vec3f.cpp: spec/spec_helper.h
spec/spec_vec4f.cpp: spec/spec_helper.h
$(BUILDDIR)/spec/spec_simd4f.o: \
include/vectorial/simd4x4f.h include/vectorial/simd4f.h \
include/vectorial/simd4f_scalar.h include/vectorial/simd4f_neon.h \
include/vectorial/simd4f_gnu.h include/vectorial/simd4f_sse.h \
include/vectorial/config.h
$(BUILDDIR)/spec/spec_simd4x4f.o: \
include/vectorial/simd4x4f.h include/vectorial/simd4f.h \
include/vectorial/simd4f_scalar.h include/vectorial/simd4f_neon.h \
include/vectorial/simd4f_gnu.h include/vectorial/simd4f_sse.h \
include/vectorial/simd4x4f_scalar.h include/vectorial/simd4x4f_neon.h \
include/vectorial/simd4x4f_gnu.h include/vectorial/simd4x4f_sse.h include/vectorial/config.h
$(BUILDDIR)/spec/spec_vec2f.o $(BUILDDIR)/spec/spec_vec3f.o $(BUILDDIR)/spec/spec_vec4f.o: \
include/vectorial/simd4x4f.h include/vectorial/simd4f.h \
include/vectorial/vec4f.h include/vectorial/vec3f.h include/vectorial/vec2f.h \
include/vectorial/simd4f_scalar.h include/vectorial/simd4f_neon.h \
include/vectorial/simd4f_gnu.h include/vectorial/simd4f_sse.h \
include/vectorial/simd4x4f_scalar.h include/vectorial/simd4x4f_neon.h \
include/vectorial/simd4x4f_gnu.h include/vectorial/simd4x4f_sse.h include/vectorial/config.h
# DO NOT DELETE
$(BUILDDIR)/spec/spec.o: spec/spec.h
$(BUILDDIR)/spec/spec_main.o: spec/spec.h
$(BUILDDIR)/spec/spec_mat4f.o: spec/spec_helper.h spec/spec.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/config.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/simd4f_gnu.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/simd4f_common.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/vec4f.h include/vectorial/vec3f.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/vec2f.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/simd4x4f.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/spec/spec_mat4f.o: include/vectorial/mat4f.h
$(BUILDDIR)/spec/spec_simd4f.o: spec/spec_helper.h spec/spec.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/config.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/simd4f_gnu.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/simd4f_common.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/vec4f.h include/vectorial/vec3f.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/vec2f.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/simd4x4f.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/spec/spec_simd4f.o: include/vectorial/mat4f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: spec/spec_helper.h spec/spec.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/config.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/simd4f_gnu.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/simd4f_common.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/vec4f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/vec3f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/vec2f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/simd4x4f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/spec/spec_simd4x4f.o: include/vectorial/mat4f.h
$(BUILDDIR)/spec/spec_vec2f.o: spec/spec_helper.h spec/spec.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/config.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/simd4f_gnu.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/simd4f_common.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/vec4f.h include/vectorial/vec3f.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/vec2f.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/simd4x4f.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/spec/spec_vec2f.o: include/vectorial/mat4f.h
$(BUILDDIR)/spec/spec_vec3f.o: spec/spec_helper.h spec/spec.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/config.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/simd4f_gnu.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/simd4f_common.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/vec4f.h include/vectorial/vec3f.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/vec2f.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/simd4x4f.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/spec/spec_vec3f.o: include/vectorial/mat4f.h
$(BUILDDIR)/spec/spec_vec4f.o: spec/spec_helper.h spec/spec.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/config.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/simd4f_gnu.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/simd4f_common.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/vec4f.h include/vectorial/vec3f.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/vec2f.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/simd4x4f.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/simd4f.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/spec/spec_vec4f.o: include/vectorial/mat4f.h
$(BUILDDIR)/bench/add_bench.o: bench/bench.h include/vectorial/vec4f.h
$(BUILDDIR)/bench/bench.o: bench/bench.h include/vectorial/config.h
$(BUILDDIR)/bench/dot_bench.o: bench/bench.h include/vectorial/vec4f.h
$(BUILDDIR)/bench/matrix_bench.o: bench/bench.h include/vectorial/simd4x4f.h
$(BUILDDIR)/bench/matrix_bench.o: include/vectorial/simd4f.h
$(BUILDDIR)/bench/matrix_bench.o: include/vectorial/simd4x4f_gnu.h
$(BUILDDIR)/bench/quad_bench.o: bench/bench.h include/vectorial/simd4x4f.h
$(BUILDDIR)/bench/quad_bench.o: include/vectorial/simd4f.h
$(BUILDDIR)/bench/quad_bench.o: include/vectorial/simd4x4f_gnu.h