forked from sysprog21/dict
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (58 loc) · 1.51 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
TESTS = test_cpy test_ref
TEST_DATA = s Tai
CFLAGS = -O0 -Wall -Werror -g
# Control the build verbosity
ifeq ("$(VERBOSE)","1")
Q :=
VECHO = @true
else
Q := @
VECHO = @printf
endif
GIT_HOOKS := .git/hooks/applied
.PHONY: all clean
all: $(GIT_HOOKS) $(TESTS)
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
OBJS_LIB = \
tst.o bloom.o
OBJS := \
$(OBJS_LIB) \
test_cpy.o \
test_ref.o
deps := $(OBJS:%.o=.%.o.d)
test_%: test_%.o $(OBJS_LIB)
$(VECHO) " LD\t$@\n"
$(Q)$(CC) $(LDFLAGS) -o $@ $^ -lm
%.o: %.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF .$@.d $<
test: $(TESTS)
echo 3 | sudo tee /proc/sys/vm/drop_caches;
perf stat --repeat 100 \
-e cache-misses,cache-references,instructions,cycles \
./test_cpy --bench $(TEST_DATA)
perf stat --repeat 100 \
-e cache-misses,cache-references,instructions,cycles \
./test_ref --bench $(TEST_DATA)
cal: calculate.c
gcc -o calculate calculate.c
./calculate
one_test: test_cpy test_ref
./test_cpy --bench
./test_ref --bench
plot: one_test bench_cpy.txt bench_ref.txt output.txt
$(Q)gnuplot scripts/runtime.gp
$(Q)gnuplot scripts/runtime3.gp
$(Q)gnuplot scripts/runtimept.gp
$(Q)gnuplot scripts/runtimebox.gp
bench: $(TESTS)
@for test in $(TESTS); do\
./$$test --bench $(TEST_DATA); \
done
clean:
$(RM) $(TESTS) $(OBJS)
$(RM) $(deps)
rm -f bench_cpy.txt bench_ref.txt ref.txt cpy.txt calculate
-include $(deps)