-
Notifications
You must be signed in to change notification settings - Fork 87
/
def.mk
97 lines (70 loc) · 2.42 KB
/
def.mk
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# define make macros here
OPTIMIZE=-O2
LINKARGS=-ltcmalloc
#CUDA_SUPPORT=true
DEFAULTPLATFORM=-DHOST_PLATFORM_AWS
#DEFAULTPLATFORM=-DHOST_PLATFORM_GCP
#DEFAULTPLATFORM=-DHOST_PLATFORM_AZURE
#DEFAULTPLATFORM=-DHOST_PLATFORM_TENCENT
#DEFAULTPLATFORM=-DHOST_PLATFORM_ALIYUN
MACOS_SSL_INCLUDE_PATH=/usr/local/opt/[email protected]/include
MACOS_SSL_LIB_PATH=/usr/local/opt/[email protected]/lib
CUDA_INCLUDE_PATH=/usr/local/cuda/include
CFLAGS += $(DEFAULTPLATFORM)
CXXFLAGS += -std=c++11 $(DEFAULTPLATFORM)
CPPFLAGS += -g -Wall -Werror -fPIC $(OPTIMIZE)
LIBS += $(OPTIMIZE) -rdynamic -lstdc++ -lfpnn -lfpproto -lextends -lfpbase -lpthread -lz -lssl -lcrypto -lcurl $(LINKARGS)
#LIBS += $(OPTIMIZE) -static-libstdc++ -lcurl -lfpnn -lfpproto -lextends -lfpbase -lpthread -lz -lssl -lcrypto $(LINKARGS)
#for apps
$(EXES_CLIENT): $(OBJS_CLIENT)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_CLIENT2): $(OBJS_CLIENT2)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_CLIENT3): $(OBJS_CLIENT3)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_SERVER): $(OBJS_SERVER)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_SERVER2): $(OBJS_SERVER2)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_SERVER3): $(OBJS_SERVER3)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_TEST): $(OBJS_TEST)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_TEST2): $(OBJS_TEST2)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_TEST3): $(OBJS_TEST3)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_TEST4): $(OBJS_TEST4)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
$(EXES_TEST5): $(OBJS_TEST5)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
#for libs
#for libs
$(LIBFPNN_A): $(OBJS_C) $(OBJS_CXX)
$(AR) -rcs $@ $(OBJS_C) $(OBJS_CXX)
$(LIBFPNN_S_SO): $(OBJS_C)
$(CC) -shared -o $@ -Wl,-soname,$(LIBFPNN_S_SO) $(OBJS_C)
$(LIBFPNN_X_SO): $(OBJS_CXX)
$(CC) -shared -o $@ -Wl,-soname,$(LIBFPNN_X_SO) $(OBJS_CXX)
#for rules
.c.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
.c:
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LIBS)
.cpp:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LIBS)
#for MacOS
UNAME := $(shell uname -s)
ifeq ($(UNAME), Darwin)
LINKARGS =
DEFAULTPLATFORM =
CXXFLAGS += -I$(MACOS_SSL_INCLUDE_PATH)
LIBS += -L$(MACOS_SSL_LIB_PATH)
endif
#for CUDA
ifeq ($(CUDA_SUPPORT), true)
CXXFLAGS += -I$(CUDA_INCLUDE_PATH) -DSUPPORT_CUDA
LIBS += -lnvidia-ml
endif