-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
92 lines (67 loc) · 2.93 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
CC=gcc
CXX=g++
AR=ar
LN=ln -s
PRJPATH=$(shell pwd)
CPPFLAGS = -g -O2 -Wall -fPIC -fno-strict-aliasing -I$(PRJPATH) -I$(PRJPATH)/ev
LDLIBS = -lpthread -L$(PRJPATH)/ -lserver -lclient -L$(PRJPATH)/ev -lev
DY_LDFLAGS = -shared -fPIC
ST_LDFLAGS = crs
VERSION_INFO = .0.1.9
COMPILE.CXX = $(CXX) $(CPPFLAGS) -c
COMPILE.C = $(CC) $(CPPFLAGS) -c
LINK.SHARE = $(CXX) $(DY_LDFLAGS)
LINK.STATIC = $(AR) $(ST_LDFLAGS)
SERVERCOMMONOBJS=iserver.o tcpserver.o udpserver.o commonserver.o
SERVERLIB=libserver.a
SERVERLIBSHARE=libserver.so
SERVERLIBSHAREV=libserver.so$(VERSION_INFO)
CLIENTCOMMONOBJS=iclient.o tcpclient.o udpclient.o
CLIENTLIB=libclient.a
CLIENTLIBSHARE=libclient.so
CLIENTLIBSHAREV=libclient.so$(VERSION_INFO)
TESTOBJS=test/tcpechoserver.o test/tcpechoclient.o test/udpechoserver.o test/udpechoclient.o test/tcpproxy.o test/tcpproxytest.o test/tcpcommonechoserver.o test/udpproxy.o test/udpproxytest.o
TCPECHOSERVER=test/tcpechoserver
TCPECHOCLIENT=test/tcpechoclient
UDPECHOSERVER=test/udpechoserver
UDPECHOCLIENT=test/udpechoclient
TCPPROXY=test/tcpproxy
TCPPROXYTEST=test/tcpproxytest
TCPCOMMONECHOSERVER=test/tcpcommonechoserver
UDPPROXY=test/udpproxy
UDPPROXYTEST=test/udpproxytest
TESTAPPS=$(TCPECHOSERVER) $(TCPECHOCLIENT) $(UDPECHOSERVER) $(UDPECHOCLIENT) $(TCPPROXY) $(TCPPROXYTEST) $(TCPCOMMONECHOSERVER) $(UDPPROXY) $(UDPPROXYTEST)
all: $(SERVERLIB) $(SERVERLIBSHARE) $(CLIENTLIB) $(CLIENTLIBSHARE)
test: $(TESTAPPS)
%.o:%.cpp %.h
$(COMPILE.CXX) $< -o $@
$(SERVERLIB): $(SERVERCOMMONOBJS)
$(LINK.STATIC) $@ $(SERVERCOMMONOBJS)
$(SERVERLIBSHARE): $(SERVERCOMMONOBJS)
$(LINK.SHARE) -o $(SERVERLIBSHAREV) $(SERVERCOMMONOBJS)
$(LN) $(SERVERLIBSHAREV) $(SERVERLIBSHARE)
$(CLIENTLIB): $(CLIENTCOMMONOBJS)
$(LINK.STATIC) $@ $(CLIENTCOMMONOBJS)
$(CLIENTLIBSHARE): $(CLIENTCOMMONOBJS)
$(LINK.SHARE) -o $(CLIENTLIBSHAREV) $(CLIENTCOMMONOBJS)
$(LN) $(CLIENTLIBSHAREV) $(CLIENTLIBSHARE)
$(TCPECHOSERVER): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/tcpechoserver.o $(LDLIBS)
$(TCPECHOCLIENT): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/tcpechoclient.o $(LDLIBS)
$(UDPECHOSERVER): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/udpechoserver.o $(LDLIBS)
$(UDPECHOCLIENT): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/udpechoclient.o $(LDLIBS)
$(TCPPROXY): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/tcpproxy.o $(LDLIBS)
$(TCPPROXYTEST): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/tcpproxytest.o $(LDLIBS)
$(TCPCOMMONECHOSERVER): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/tcpcommonechoserver.o $(LDLIBS)
$(UDPPROXY): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/udpproxy.o $(LDLIBS)
$(UDPPROXYTEST): $(TESTOBJS) $(SERVERLIB) $(CLIENTLIB)
$(CXX) -o $@ test/udpproxytest.o $(LDLIBS)
clean:
rm -f $(SERVERCOMMONOBJS) $(SERVERLIB) $(SERVERLIBSHARE) $(SERVERLIBSHAREV) $(CLIENTCOMMONOBJS) $(CLIENTLIB) $(CLIENTLIBSHARE) $(CLIENTLIBSHAREV) $(TESTOBJS) $(TESTAPPS)