forked from sysprog21/matrix_oo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (51 loc) · 1.21 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
EXEC = \
tests/test-matrix \
tests/test-stopwatch
GIT_HOOKS := .git/hooks/applied
OUT ?= .build
.PHONY: all
all: $(GIT_HOOKS) $(OUT) $(EXEC)
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
CC ?= gcc
CFLAGS = -Wall -std=gnu99 -O2 -I. -mavx2 -g
LDFLAGS = -lpthread
ifeq ($(strip $(PROFILE)),1)
PROF_FLAGS = -pg
CFLAGS += $(PROF_FLAGS)
LDFLAGS += $(PROF_FLAGS)
endif
OBJS := \
stopwatch.o \
matrix_naive.o \
matrix_sse.o \
matrix_avx.o \
matrix_strassen.o \
matrix_strassen_sse.o
deps := $(OBJS:%.o=%.o.d)
OBJS := $(addprefix $(OUT)/,$(OBJS))
deps := $(addprefix $(OUT)/,$(deps))
astyle:
astyle --style=kr --indent=spaces=4 --indent-switches --suffix=none *.[ch]
tests/test-%: $(OBJS) tests/test-%.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(OUT)/%.o: %.c $(OUT)
$(CC) $(CFLAGS) -c -o $@ -MMD -MF $@.d $<
$(OUT):
@mkdir -p $@
check: $(EXEC)
@for test in $^ ; \
do \
echo "Execute $$test..." ; $$test && echo "OK!\n" ; \
done
check-matrix: $(EXEC)
echo "Execute $<..." ; $< && echo "OK!\n" ;
make plot: check
gnuplot scripts/runtime.gp
time-check: $(EXEC) check-matrix
gprof -b $< gmon.out | less
clean:
$(RM) $(EXEC) $(OBJS) $(deps) record.csv runtime.png gmon.out
@rm -rf $(OUT)
-include $(deps)