forked from sysprog21/prefix-search
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (64 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
81 lines (64 loc) · 1.6 KB
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
TESTS = \
test_cpy \
test_ref
CFLAGS = -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 \
ref.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 $@ $^
%.o: %.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF .$@.d $<
clean:
$(RM) $(TESTS) $(OBJS)
$(RM) $(deps)
bench:$(TESTS) test.txt
gcc bench.c `pkg-config --cflags --libs glib-2.0` -o bench
./bench
gcc caculate.c -o caculate -lm
./caculate
gcc caculate_ref.c -o caculate_ref -lm
./caculate_ref
plot: bench
gnuplot scripts/runtime.gp
gnuplot scripts/runtime2.gp
run-cache-test: $(TESTS)
echo 3 | sudo tee /proc/sys/vm/drop_caches
perf stat --repeat 1 \
-e cache-misses,cache-references,instructions,cycles \
./test_cpy<test.txt>-
echo 3 | sudo tee /proc/sys/vm/drop_caches
perf stat --repeat 1 \
-e cache-misses,cache-references,instructions,cycles \
./test_ref<test.txt>-
build-cache-test: $(TESTS)
echo 3 | sudo tee /proc/sys/vm/drop_caches
perf stat --repeat 5 \
-e cache-misses,cache-references,instructions,cycles \
./test_cpy<test2.txt>-
echo 3 | sudo tee /proc/sys/vm/drop_caches
perf stat --repeat 5 \
-e cache-misses,cache-references,instructions,cycles \
./test_ref<test2.txt>-
-include $(deps)