forked from dmlc/parameter_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (45 loc) · 1.64 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
CC = g++
# OPT = -O0 -ggdb
OPT = -O3 -ggdb
THIRD_PATH=$(shell pwd)/third_party
STATIC_THIRD_LIB=0
ifeq ($(STATIC_THIRD_LIB), 1)
THIRD_LIB=$(addprefix $(THIRD_PATH)/lib/, libgflags.a libzmq.a libprotobuf.a libglog.a libz.a libsnappy.a)
else
THIRD_LIB=-L$(THIRD_PATH)/lib -lgflags -lzmq -lprotobuf -lglog -lz -lsnappy
endif
# THIRD_LIB+=-ltcmalloc_and_profiler
WARN = -Wall -Wno-unused-function -finline-functions -Wno-sign-compare #-Wconversion
INCPATH = -I./src -I$(THIRD_PATH)/include
CFLAGS = -std=c++0x $(WARN) $(OPT) $(INCPATH)
LDFLAGS += $(THIRD_LIB) -lpthread -lrt
PS_LIB = build/libps.a
PS_MAIN = build/libpsmain.a
all: ps app
clean:
rm -rf build
ps: $(PS_LIB) $(PS_MAIN)
app: build/ps
build/hello: build/app/hello_world/main.o $(PS_LIB) $(PS_MAIN)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
sys_srcs = $(wildcard src/util/*.cc) $(wildcard src/data/*.cc) \
$(wildcard src/system/*.cc) $(wildcard src/filter/*.cc)
sys_protos = $(wildcard src/*/proto/*.proto)
sys_objs = $(patsubst src/%.proto, build/%.pb.o, $(sys_protos)) \
$(patsubst src/%.cc, build/%.o, $(sys_srcs))
build/libps.a: $(sys_objs)
ar crv $@ $?
build/libpsmain.a: build/ps_main.o
ar crv $@ $?
app_objs = $(addprefix build/app/, main/proto/app.pb.o linear_method/linear.o linear_method/proto/linear.pb.o)
build/ps: build/app/main/main.o $(app_objs) $(PS_LIB)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
build/%.o: src/%.cc
@mkdir -p $(@D)
$(CC) $(INCPATH) -std=c++0x -MM -MT build/$*.o $< >build/$*.d
$(CC) $(CFLAGS) -c $< -o $@
%.pb.cc %.pb.h : %.proto
${THIRD_PATH}/bin/protoc --cpp_out=./src --proto_path=./src $<
-include build/*/*.d
-include build/*/*/*.d
-include src/test/build.mk