forked from microsoft/Multiverso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (49 loc) · 1.77 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
PROJECT := $(shell readlink $(dir $(lastword $(MAKEFILE_LIST))) -f)
CXX = g++
CXXFLAGS = -O3 \
-std=c++11 \
-Wall \
-Wno-sign-compare \
-fno-omit-frame-pointer \
-fpermissive
HEADERS_DIR = $(PROJECT)/include/multiverso
MULTIVERSO_SRC = $(PROJECT)/src/multiverso
MULTIVERSO_SERVER_SRC = $(PROJECT)/src/multiverso_server
THIRD_PARTY = $(PROJECT)/third_party
THIRD_PARTY_INC = $(THIRD_PARTY)/include
THIRD_PARTY_LIB = $(THIRD_PARTY)/lib
INC_FLAGS = -I$(HEADERS_DIR)
INC_FLAGS += -I$(THIRD_PARTY_INC)
LD_FLAGS = -L$(THIRD_PARTY_LIB) -lzmq -lmpich -lmpl
LIB_SRC_DIR = $(PROJECT)/src/multiverso
SERVER_SRC_DIR = $(PROJECT)/src/multiverso_server
HEADERS = $(shell find $(HEADERS_DIR) -type f -name "*.h")
LIB_SRC = $(shell find $(MULTIVERSO_SRC) -type f -name "*.cpp")
SERVER_HEADERS = $(shell find $(MULTIVERSO_SERVER_SRC) -type f -name "*.h")
SERVER_SRC = $(shell find $(MULTIVERSO_SERVER_SRC) -type f -name "*.cpp")
LIB_OBJ = $(LIB_SRC:.cpp=.o)
SERVER_OBJ = $(SERVER_SRC:.cpp=.o)
BIN = $(PROJECT)/bin
LIB = $(PROJECT)/lib
MULTIVERSO_LIB = $(LIB)/libmultiverso.a
MULTIVERSO_SERVER = $(BIN)/multiverso_server
MKDIR = $(BIN) \
$(LIB)
all: path \
multiverso \
multiverso_server
path: $(MKDIR)
$(MKDIR):
mkdir -p $@
$(MULTIVERSO_LIB): $(LIB_OBJ)
ar csrv $@ $(LIB_OBJ)
$(MULTIVERSO_SERVER): $(SERVER_OBJ) $(MULTIVERSO_LIB)
$(CXX) $(SERVER_OBJ) $(MULTIVERSO_LIB) $(CXXFLAGS) $(INC_FLAGS) $(LD_FLAGS) -o $@
$(LIB_OBJ): %.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) $(INC_FLAGS) -c $< -o $@
$(SERVER_OBJ): %.o: %.cpp $(HEADERS) $(SERVER_HEADERS)
$(CXX) $(CXXFLAGS) $(INC_FLAGS) $(LD_FLAGS) -c $< -o $@
multiverso: path $(MULTIVERSO_LIB)
multiverso_server: path $(MULTIVERSO_SERVER)
clean:
rm -rf $(BIN) $(LIB) $(LIB_OBJ) $(SERVER_OBJ)