-
Notifications
You must be signed in to change notification settings - Fork 563
/
phxrpc.mk
57 lines (38 loc) · 1.23 KB
/
phxrpc.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
#--------------------------------------------------------------------
#debug = y
where-am-i = $(abspath $(word $(words $(MAKEFILE_LIST)), $(MAKEFILE_LIST)))
#$(warning $(dir $(call where-am-i)))
PHXRPC_ROOT = $(dir $(call where-am-i))
OS := $(shell uname)
PROTOBUF_ROOT = $(PHXRPC_ROOT)/third_party/protobuf
BOOST_ROOT = $(PHXRPC_ROOT)/third_party/boost
PLUGIN_BOOST_LDFLAGS = -Wl,--whole-archive -L$(PHXRPC_ROOT)/lib/ -lphxrpc_plugin_boost \
-Wl,--no-whole-archive -L$(BOOST_ROOT)/lib/ -lboost_context
#--------------------------------------------------------------------
ifeq ($(debug), y)
# (1) Debug
OPT = -g2
else
# (2) Production
OPT = -O2
endif
CC = gcc
AR = ar cru
SOFLAGS = -shared -Wl,-h,$@
LINKER = $(CC)
LINT = lint -c
RM = /bin/rm -f
CFLAGS = -std=c++11 -Wall -D_REENTRANT -D_GNU_SOURCE -D_XOPEN_SOURCE -fPIC -m64 $(OPT) \
-I$(PROTOBUF_ROOT)/include \
-I$(PHXRPC_ROOT)
LDFLAGS = -L$(PROTOBUF_ROOT)/lib/ $(PROTOBUF_ROOT)/lib/libprotobuf.a \
-lstdc++ -lpthread -lm
PBFLAGS = -I $(PROTOBUF_ROOT)/include -I $(PHXRPC_ROOT)
#--------------------------------------------------------------------
# make rule
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o : %.cc
$(CC) $(CFLAGS) -c $< -o $@
%.o : %.cpp
$(CC) $(CFLAGS) -c $< -o $@