forked from ytyou/ticktock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.centos
81 lines (60 loc) · 1.83 KB
/
Makefile.centos
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
default: build
CC = gcc
CPP = g++
LINK = $(CPP)
RM = /usr/bin/rm -f
#DEBUG_FLAGS = -g3 -rdynamic -ggdb -D_DEBUG -D_TEST -D_GLIBCXX_DEBUG -O0
PROD_FLAGS = -O3 -march=native -ffast-math
#LEAK_FLAGS = -D_LEAK_DETECTION
#PROF_FLAGS = -pg -D_GLIBCXX_DEBUG
LIBS = /usr/lib64/libz.so
CFLAGS = -I include -std=c++11 $(DEBUG_FLAGS) $(PROF_FLAGS) $(LEAK_FLAGS) $(PROD_FLAGS)
LFLAGS = -lpthread $(PROF_FLAGS) $(DEBUG_FLAGS)
INCS = $(wildcard include/*.h)
TINCS = $(wildcard test/include/*.h)
SRCS = $(wildcard src/*.cpp src/*/*.cpp)
TMPS = $(subst src,objs,$(SRCS))
OBJS = $(patsubst %.cpp,%.o,$(TMPS))
OBJI = $(filter-out objs/main.o,$(OBJS))
OBJJ = $(filter-out objs/stress_test.o,$(OBJI))
OBJL = $(filter-out objs/admin.o,$(OBJJ))
SRCT = $(wildcard test/*.cpp)
TMPT = $(subst test,objs,$(SRCT))
OBJT = $(patsubst %.cpp,%.o,$(TMPT))
TARGET = bin/tt
TESTS = bin/all_tests
TOOLS = bin/inspect
build: $(TARGET)
bin/tt: $(OBJS)
@mkdir -p $(@D)
$(LINK) $(LFLAGS) -o $@ $(OBJS) $(LIBS)
objs/%.o: src/%.cpp $(INCS)
@mkdir -p $(@D)
$(CPP) $(CFLAGS) -c $< -o $@
objs/*/%.o: src/*/%.cpp $(INCS)
@mkdir -p $(@D)
$(CPP) $(CFLAGS) -c $< -o $@
objs/tools/%.o: tools/%.cpp
@mkdir -p $(@D)
$(CPP) $(CFLAGS) -c $< -o $@
TSRCS = $(wildcard test/*.cpp)
TOBJS = $(patsubst %.cpp,objs/%.o,$(TSRCS))
test: $(TESTS)
objs/test/%.o: test/%.cpp $(INCS) $(TINCS)
@mkdir -p $(@D)
$(CPP) $(CFLAGS) -I test/include -c $< -o $@
bin/all_tests: $(OBJI) $(TOBJS)
@mkdir -p $(@D)
$(LINK) $(LFLAGS) -o $@ $(OBJI) $(TOBJS) $(LIBS)
tools: $(TOOLS)
UOBJS = $(wildcard objs/tools/*.o)
#bin/backfill: objs/tools/backfill.o
# @mkdir -p $(@D)
# $(LINK) $(LFLAGS) -o $@ $< $(LIBS)
bin/inspect: objs/tools/inspect.o $(OBJI)
@mkdir -p $(@D)
$(LINK) $(LFLAGS) -o $@ $< $(OBJI) $(LIBS)
tt: clean build
all: build test tools
clean:
$(RM) $(OBJS) $(TOBJS) $(UOBJS) $(TARGET) $(TESTS) $(TOOLS)