forked from OpenAtomFoundation/pika
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (61 loc) · 1.76 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
RPATH = /usr/local/pika/lib/
OSVERSION := $(shell cat /etc/redhat-release | cut -d "." -f 1 | awk '{print $$NF}')
ifeq ($(OSVERSION), 5)
LFLAGS = -Wl,-rpath=$(RPATH)
endif
CXX = g++
CXXFLAGS = -Wall -W -DDEBUG -g -O0 -D__XDEBUG__ -fPIC -Wno-unused-function -std=c++11
OBJECT = pika
SRC_DIR = ./src
THIRD_PATH = ./third
OUTPUT = ./output
INCLUDE_PATH = -I./include/ \
-I./src/ \
-I$(THIRD_PATH)/glog/src/ \
-I$(THIRD_PATH)/nemo/output/include/ \
-I$(THIRD_PATH)/mario/output/include/
LIB_PATH = -L./ \
-L$(THIRD_PATH)/nemo/output/lib/ \
-L$(THIRD_PATH)/mario/output/lib/
LIBS = -lpthread \
-lglog \
-lnemo \
-lmario \
-lrocksdb \
-lz \
-lbz2 \
-lsnappy \
-lrt
ROCKSDB = $(THIRD_PATH)/nemo/output/lib/librocksdb.a
GLOG = /usr/local/lib/libglog.a
MARIO = $(THIRD_PATH)/mario/output/lib/libmario.a
.PHONY: all clean
BASE_OBJS := $(wildcard $(SRC_DIR)/*.cc)
BASE_OBJS += $(wildcard $(SRC_DIR)/*.c)
BASE_OBJS += $(wildcard $(SRC_DIR)/*.cpp)
OBJS = $(patsubst %.cc,%.o,$(BASE_OBJS))
all: $(OBJECT)
rm -rf $(OUTPUT)
mkdir $(OUTPUT)
mkdir $(OUTPUT)/bin
cp -r ./conf $(OUTPUT)/
cp -r ./lib $(OUTPUT)/
cp $(OBJECT) $(OUTPUT)/bin/
rm -rf $(OBJECT)
@echo "Success, go, go, go..."
$(OBJECT): $(ROCKSDB) $(GLOG) $(MARIO) $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(INCLUDE_PATH) $(LIB_PATH) $(LFLAGS) $(LIBS)
$(ROCKSDB):
make -C $(THIRD_PATH)/nemo/
$(GLOG):
cd $(THIRD_PATH)/glog; ./configure; make; echo '*' > $(CURDIR)/third/glog/.gitignore; sudo make install;
$(MARIO):
make -C $(THIRD_PATH)/mario/
$(OBJS): %.o : %.cc
$(CXX) $(CXXFLAGS) -c $< -o $@ $(INCLUDE_PATH)
$(TOBJS): %.o : %.cc
$(CXX) $(CXXFLAGS) -c $< -o $@ $(INCLUDE_PATH)
clean:
rm -rf $(SRC_DIR)/*.o
rm -rf $(OUTPUT)/*
rm -rf $(OUTPUT)