-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
48 lines (39 loc) · 861 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
46
47
48
-include config.mk
CXXFLAGS := -Wall -Werror -g -O2 --std=c++0x -DNDEBUG
LDFLAGS := -lpthread -lrt
# 0 = libc malloc
# 1 = jemalloc
# 2 = tcmalloc
USE_MALLOC_MODE=1
ifeq ($(USE_MALLOC_MODE),1)
CXXFLAGS+=-DUSE_JEMALLOC
LDFLAGS+=-ljemalloc
else
ifeq ($(USE_MALLOC_MODE),2)
CXXFLAGS+=-DUSE_TCMALLOC
LDFLAGS+=-ltcmalloc
endif
endif
HEADERS = macros.hpp \
spinlock.hpp \
rcu.hpp \
util.hpp \
timer.hpp \
policy.hpp \
linked_list.hpp \
global_lock_impl.hpp \
per_node_lock_impl.hpp \
lock_free_impl.hpp \
atomic_reference.hpp
SRCFILES = rcu.cpp
OBJFILES = $(SRCFILES:.cpp=.o)
all: test
%.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -c $< -o $@
test: test.o $(OBJFILES)
$(CXX) -o test $^ $(LDFLAGS)
bench: bench.o $(OBJFILES)
$(CXX) -o bench $^ $(LDFLAGS)
.PHONY: clean
clean:
rm -f test bench *.o