forked from sysprog21/matrix_oo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (34 loc) · 754 Bytes
/
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
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 -g -O2 -I.
LDFLAGS = -lpthread
OBJS := \
stopwatch.o \
matrix_naive.o
deps := $(OBJS:%.o=%.o.d)
OBJS := $(addprefix $(OUT)/,$(OBJS))
deps := $(addprefix $(OUT)/,$(deps))
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
clean:
$(RM) $(EXEC) $(OBJS) $(deps)
@rm -rf $(OUT)
-include $(deps)