-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
75 lines (55 loc) · 2.15 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
GCCCXX=g++
GCCCXXFLAGS=-std=c++17
CLANGHOME=./clang5
CLANGCXX=$(CLANGHOME)/bin/clang++
CLANGCXXFLAGS=-std=c++17 -stdlib=libc++
OS := $(shell uname)
ifeq ($(OS),Darwin)
LDFLAGS=-Xpreprocessor -fopenmp -lomp
else
LDFLAGS=-fopenmp
endif
HEADERS=src/benchmark.h src/datasets.h src/benchmark_utils.h \
src/algorithms/binary_search.h src/padded_vector.h \
src/util.h src/algorithms/div.h src/algorithms/linear_search.h \
src/algorithms/sip.h src/algorithms/tip.h
SOURCES=src/benchmark.cc
.PHONY: run gdb clean perf dump dump_bin txt_to_bin bin_to_txt sample_bin
##### Run Targets ######
run : searchbench experiments.tsv
gdb : debug_searchbench
gdb :
gdb --args ./debug experiments.tsv
perf : CLANGCXXFLAGS += -O3 -DNDEBUG -DINFINITE_REPEAT
perf :
$(CLANGCXX) $(CLANGCXXFLAGS) $(SOURCES) -o$@ $(LDFLAGS)
perf record -F99 -g ./perf experiments.tsv
clean:
rm -f ./searchbench ./debug ./dump ./dump_bin ./txt_to_bin ./sample_bin ./bin_to_txt
dumpall: dump dump_bin txt_to_bin bin_to_txt sample_bin
## GCC ###############
####### Build Targets #########
searchbench: GCCCXXFLAGS += -O3 -DNDEBUG
searchbench: $(SOURCES) $(HEADERS)
$(GCCCXX) $(GCCCXXFLAGS) $(SOURCES) -o$@ $(LDFLAGS)
debug_searchbench : GCCCXXFLAGS += -O0
debug_searchbench : $(SOURCES) $(HEADERS)
$(GCCCXX) $(GCCCXXFLAGS) $(SOURCES) -o$@ $(LDFLAGS)
dump : src/dump.cc src/benchmark.h
$(CXX) $(GCCCXXFLAGS) src/dump.cc -o$@ $(LDFLAGS)
dump_bin : src/dump_bin.cc src/benchmark.h
$(CXX) $(GCCCXXFLAGS) src/dump_bin.cc -o$@ $(LDFLAGS)
txt_to_bin: src/convert_txt_to_bin.cc src/benchmark.h
$(CXX) $(GCCCXXFLAGS) src/convert_txt_to_bin.cc -o$@ $(LDFLAGS)
bin_to_txt: src/convert_bin_to_txt.cc src/benchmark.h
$(CXX) $(GCCCXXFLAGS) src/convert_bin_to_txt.cc -o$@ $(LDFLAGS)
sample_bin: src/sample_bin.cc src/benchmark.h
$(CXX) $(GCCCXXFLAGS) src/sample_bin.cc -o$@ $(LDFLAGS)
## CLANG ######################
####### Build Targets #########
clang5_searchbench: CLANGCXXFLAGS += -O3 -DNDEBUG
clang5_searchbench: $(SOURCES) $(HEADERS)
$(CLANGCXX) $(CLANGCXXFLAGS) $(SOURCES) -o$@ $(LDFLAGS)
clang5_debug: CLANGCXXFLAGS += -O0
clang5_debug: $(SOURCES) $(HEADERS)
$(CLANGCXX) $(CLANGCXXFLAGS) $(SOURCES) -o$@ $(LDFLAGS)