-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
70 lines (54 loc) · 1.34 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
#
# date: 2014-08-06
#
TARGET=tsdb
OBJ_DIR=./obj
SRC=./src
INC_DIR=-I./lib/libev-4.15 \
-I./lib/json-c \
-I./lib/leveldb-1.14.0/include \
-I./lib/zookeeper-3.4.6/src/c/include \
-I./lib/zookeeper-3.4.6/src/c/generated
LIB_DIR=./lib
LIBS=-lpthread -lstdc++ -lm -lrt
LIBA=-lev -ljson-c -lleveldb -lsnappy -lzookeeper_mt
CFLAGS=-Wall -g -DOPEN_PTHREAD -DOPEN_STATIC -DOPEN_COMPRESSION -DOPEN_DEBUG
#CFLAGS=-Wall -O2 -DOPEN_PTHREAD -DOPEN_STATIC -DOPEN_COMPRESSION
OBJ = $(addprefix $(OBJ_DIR)/, \
ldb.o \
main.o \
read_cfg.o \
ctl.o \
utils.o \
zk.o \
logger.o \
binlog.o \
slave.o \
)
help:
@echo "make libs first!"
libs:
$(MAKE) -C $(LIB_DIR) clean
$(MAKE) -C $(LIB_DIR)
all:$(OBJ)
gcc $(CFLAGS) $^ $(INC_DIR) -L$(LIB_DIR) $(LIBS) $(LIBA) -o $(TARGET)
$(OBJ_DIR)/%.o:$(SRC)/%.c
@-if [ ! -d $(OBJ_DIR) ];then mkdir $(OBJ_DIR); fi
gcc $(CFLAGS) $(INC_DIR) -L$(LIB_DIR) $(LIBS) -c $< -o $@
mc:
nohup valgrind --tool=memcheck --leak-check=full --verbose ./$(TARGET)&
push:
git push -u origin master
clean:
rm -f $(TARGET)
rm -rf $(OBJ_DIR)
@-if [ ! -d $(OBJ_DIR) ];then mkdir $(OBJ_DIR); fi
distclean:
$(MAKE) clean
$(MAKE) -C $(LIB_DIR) clean
install:
mkdir -p /data/tsdb
cp ./tsdb /data/tsdb
cp ./config.json /data/tsdb
cp ./tsdb_start.sh /data/tsdb
cp ./tsdb_stop.sh /data/tsdb