-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
153 lines (121 loc) · 4.31 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
all: rpcSampleApp rpcSampleApp_s
BUILD_CXX ?= $(CXX)
RTCORE_SRCS=\
../utf8.c \
../rtString.cpp \
../rtLog.cpp \
../rtValue.cpp \
../rtObject.cpp \
../rtError.cpp
RTRPC_SRCS=\
rtRemoteServer.cpp \
rtRemoteObject.cpp \
rtRemoteFunction.cpp \
rtRemoteMessage.cpp \
rtRemoteClient.cpp \
rtRemoteValueReader.cpp \
rtRemoteValueWriter.cpp \
rtRemoteSocketUtils.cpp \
rtRemoteStream.cpp \
rtRemoteObjectCache.cpp \
rtRemote.cpp \
rtRemoteConfig.cpp \
rtRemoteEndPoint.cpp \
rtRemoteFactory.cpp \
rtRemoteMulticastResolver.cpp \
rtRemoteConfigBuilder.cpp \
rtRemoteAsyncHandle.cpp \
rtRemoteEnvironment.cpp \
rtRemoteStreamSelector.cpp \
rtGuid.cpp \
SAMPLEAPP_SRCS=\
rpc_main.cpp
ifeq ($V, 1)
CXX_PRETTY = $(CXX)
LD_PRETTY = $(CXX)
CC_PRETTY = $(CC)
BUILD_CXX_PRETTY = $(BUILD_CXX)
else
CXX_PRETTY = @echo " [CXX] $@" ; $(CXX)
LD_PRETTY = @echo "[LINK] $@" ; $(CXX)
CC_PRETTY = @echo " [CC] $@" ; $(CC)
BUILD_CXX_PRETTY = @echo " [CC] $<" ; $(BUILD_CXX)
endif
ifeq ($(DEBUG), 1)
CXXFLAGS += -DRT_RPC_DEBUG -DRT_DEBUG
CFLAGS += -g -O0 -fno-inline
else
CXXFLAGS += -O2
CFLAGS += -O2
endif
ifeq ($(RT_REMOTE_KERNEL_GUID), 1)
CXXFLAGS += -DRT_REMOTE_KERNEL_GUID
LIBUUID =
else
LIBUUID = -luuid
endif
ifeq ($(PROFILE), 1)
CXXFLAGS += -pg
endif
CFLAGS+=-DRAPIDJSON_HAS_STDSTRING -Werror -Wall -Wextra -DRT_PLATFORM_LINUX -I../src -I. -fPIC -Wno-deprecated-declarations
CFLAGS+=-DRT_REMOTE_LOOPBACK_ONLY
CXXFLAGS+=-std=c++0x $(CFLAGS)
LDFLAGS =-pthread -ldl $(LIBUUID) -Wl,-rpath=../../,--enable-new-dtags
OBJDIR=obj
RTCORE_OBJS =$(patsubst ../%.cpp, %.o , $(notdir $(RTCORE_SRCS)))
RTCORE_OBJS:=$(patsubst %.cpp, %.o , $(notdir $(RTCORE_OBJS)))
RTCORE_OBJS:=$(patsubst %.c, %.o , $(notdir $(RTCORE_OBJS)))
RTCORE_OBJS:=$(patsubst %, $(OBJDIR)/%, $(RTCORE_OBJS))
RTRPC_OBJS =$(patsubst ../%.cpp, %.o , $(notdir $(RTRPC_SRCS)))
RTRPC_OBJS:=$(patsubst %.cpp, %.o , $(notdir $(RTRPC_OBJS)))
RTRPC_OBJS:=$(patsubst %, $(OBJDIR)/%, $(RTRPC_OBJS))
SAMPLEAPP_OBJS = $(OBJDIR)/rpc_main.o
$(OBJDIR)/rpc_main.o: rtRemoteConfig.h
RT_REMOTE_CONFIG_GEN=$(OBJDIR)/rtRemoteConfigGen
$(RT_REMOTE_CONFIG_GEN): rtRemoteConfigGen.cpp
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(BUILD_CXX_PRETTY) $(CXXFLAGS) $< -o $@
$(OBJDIR)/%.o: ../%.cpp
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(CXX_PRETTY) -c $(CXXFLAGS) $< -o $@
$(OBJDIR)/%.o: %.cpp
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(CXX_PRETTY) -c $(CXXFLAGS) $< -o $@
$(OBJDIR)/%.o : ../%.c
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(CC_PRETTY) -c $(CFLAGS) $< -o $@
debug:
@echo $(OBJS)
$(RTRPC_OBJS): rtRemoteConfig.h rtremote.conf.gen rtRemoteConfigBuilder.cpp
rtremote.conf.gen: rtremote.conf.ac $(RT_REMOTE_CONFIG_GEN)
$(RT_REMOTE_CONFIG_GEN) -i rtremote.conf.ac -c -o rtremote.conf
touch rtremote.conf.gen
#rtremote.conf: rtremote.conf.ac $(RT_REMOTE_CONFIG_GEN)
# $(RT_REMOTE_CONFIG_GEN) -i rtremote.conf.ac -c -o rtremote.conf
rtRemoteConfig.h: $(RT_REMOTE_CONFIG_GEN) rtremote.conf.ac
$(RT_REMOTE_CONFIG_GEN) -i rtremote.conf.ac -h -o rtRemoteConfig.h
rtRemoteConfigBuilder.cpp: $(RT_REMOTE_CONFIG_GEN) rtremote.conf.ac
$(RT_REMOTE_CONFIG_GEN) -i rtremote.conf.ac -s -o rtRemoteConfigBuilder.cpp
clean:
rm -rf obj
rm -f *.a *.so rpcSampleApp*
rm -f rtremote.conf.gen
rm -f rtremote.conf
rm -f rtRemoteConfig.h
rm -f rtRemoteConfigBuilder.cpp
perftest:
$(MAKE) -C tests perftest
librtRemote.so: $(RTRPC_OBJS)
$(CXX_PRETTY) $(RTRPC_OBJS) $(LDFLAGS) -shared -o $@
librtRemote_s.a: $(RTRPC_OBJS)
$(AR) rcs -o $@ $(RTRPC_OBJS)
rpcSampleApp: $(SAMPLEAPP_OBJS) librtRemote.so
$(CXX_PRETTY) $(SAMPLEAPP_OBJS) $(LDFLAGS) -o $@ -L./ -L../build/glut -L../build/glut -lrtCore -lrtRemote $(LIBUUID)
rpcSampleApp_s: $(SAMPLEAPP_OBJS) librtRemote_s.a
$(CXX_PRETTY) $(SAMPLEAPP_OBJS) $(LDFLAGS) -o $@ -L./ -L../build/glut -L../build/glut -lrtCore_s -lrtRemote_s $(LIBUUID)
rpcSampleSimple: librtRemote.so
$(CXX_PRETTY) rtSampleClient.cpp -DRT_PLATFORM_LINUX -I. -DRAPIDJSON_HAS_STDSTRING\
-o rtSampleClient -I../src -L. -L../build/glut -lrtCore -lrtRemote $(LIBUUID) -std=c++11 -pthread
$(CXX_PRETTY) rtSampleServer.cpp -DRT_PLATFORM_LINUX -I. -DRAPIDJSON_HAS_STDSTRING\
-o rtSampleServer -I../src -L. -L../build/glut -lrtCore -lrtRemote $(LIBUUID) -std=c++11 -pthread
.PHONY: all debug clean