-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (33 loc) · 1.24 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
CFLAGS := -std=c99 -Wall -Wextra -pedantic -Werror -O2 -g
BUILD := build
BIN := $(BUILD)/bin
OBJ := $(BUILD)/obj
TESTS := $(patsubst test/%.c,%,$(wildcard test/*.c))
PERFS := $(patsubst test/perf/%.c,%,$(wildcard test/perf/*.c))
all: test
test: test-basic test-sse test-avx
test-basic: $(TESTS:%=$(BIN)/%-basic)
@echo "*** default tests ***"
@for name in $^; do ./$$name || exit; done
test-sse: $(TESTS:%=$(BIN)/%-sse)
@echo "*** sse4.2 tests ***"
@for name in $^; do ./$$name || exit; done
test-avx: $(BIN)/eq-avx $(BIN)/leq-avx #$(TESTS:%=$(BIN)/%-avx)
@echo "*** avx2 tests ***"
@for name in $^; do ./$$name || exit; done
perf: $(PERFS:%=$(BIN)/%-perf)
@for name in $^; do ./$$name || exit; done
-include $(wildcard $(OBJ)/*.d)
$(BIN)/%-basic: test/%.c | $(OBJ) $(BIN)
$(CC) $(CFLAGS) -MMD -MT $@ -MF $(OBJ)/$*-basic.d $< -o $@
$(BIN)/%-sse: test/%.c | $(OBJ) $(BIN)
$(CC) $(CFLAGS) -msse4 -MMD -MT $@ -MF $(OBJ)/$*-sse.d $< -o $@
$(BIN)/%-avx: test/%.c | $(OBJ) $(BIN)
$(CC) $(CFLAGS) -mavx2 -MMD -MT $@ -MF $(OBJ)/$*-avx.d $< -o $@
$(BIN)/%-perf: test/perf/%.c | $(OBJ) $(BIN)
$(CC) $(CFLAGS) -march=native -MMD -MT $@ -MF $(OBJ)/$*-perf.d $< -o $@
$(BIN) $(OBJ):
@mkdir -p $@
clean:
rm -rf build
.PHONY: clean test test-basic test-sse perf