-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
90 lines (76 loc) · 2.41 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
78
79
80
81
82
83
84
85
86
87
88
89
90
projectpath = ${CURDIR}
lockless_path = ${projectpath}/lib/lockless_allocator
tcmalloc_path = ${projectpath}/lib/tcmalloc
lmdb_path = ${projectpath}/lib/lmdb
ifeq ($(OS),Windows_NT)
OPERATING_SYSTEM = WINDOWS
CCFLAGS += -D WIN32
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
CCFLAGS += -D AMD64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CCFLAGS += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CCFLAGS += -D IA32
endif
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OPERATING_SYSTEM = LINUX
PLATFORM_TARGET = linux
CCFLAGS += -D LINUX
endif
ifeq ($(UNAME_S),Darwin)
OPERATING_SYSTEM = OSX
PLATFORM_TARGET = osx
CCFLAGS += -D OSX
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CCFLAGS += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CCFLAGS += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CCFLAGS += -D ARM
endif
endif
all: deps $(PLATFORM_TARGET)
target: all
clean:
@rm -rf build
osx: deps
if [ ! -d "build" ]; then mkdir -p build; fi
if [ ! -d "build/Makefile" ]; then cd build;cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 ..; fi
cmake --build ./build --target all --config Debug -- -j 10
xcode: deps
if [ ! -d "build" ]; then mkdir -p build; fi
if [ ! -d "build/rewind.xcodeproj" ]; then cd build;cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 -G Xcode ..; fi
cd build;xcodebuild -project rewind.xcodeproj/
linux: deps $(lockless_path)
rm -rf build
mkdir -p build
cd build;cmake ..
cd build;make VERBOSE=1
$(tcmalloc_path):
if [ ! -d "$(tcmalloc_path)" ]; then git clone https://github.com/gperftools/gperftools.git $(tcmalloc_path); fi
cd $(tcmalloc_path);./autogen.sh
cd $(tcmalloc_path);./configure
cd $(tcmalloc_path);make
$(lockless_path):
if [ ! -d "$(lockless_path)" ]; then wget https://locklessinc.com/downloads/lockless_allocator_src.tgz -P lib; fi
cd lib;tar xvzf lockless_allocator_src.tgz
cd lib/lockless_allocator;make
$(lmdb_path)/libraries/liblmdb/liblmdb.a:
if [ ! -d "$(lmdb_path)" ]; then git clone https://github.com/LMDB/lmdb.git $(lmdb_path); fi
cd $(lmdb_path)/libraries/liblmdb;make
tools: $(wrk_path)/wrk $(wrk2_path)/wrk
test: $(PLATFORM_TARGET)
./build/tests
benchmark: $(PLATFORM_TARGET)
@rm -rf /tmp/benchmark*
./build/benchmarks --durations yes
deps: $(lmdb_path)/libraries/liblmdb/liblmdb.a