-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
executable file
·39 lines (27 loc) · 912 Bytes
/
makefile
File metadata and controls
executable file
·39 lines (27 loc) · 912 Bytes
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
#usage: make TestEchoClient.out
#debug example: gdb --args ./TestEchoClient.out 127.0.0.1
libname := libnet.a
SRC_FOLDERS := ./libnet/net
SRC_FOLDERS += ./libnet/utils
VPATH := $(SRC_FOLDERS)
TestDir := ./libnet/test
INC_DIRS = $(foreach dir, $(SRC_FOLDERS), -I$(dir))
LDFLAGS= -L. -pthread -lnet #note:1) -lnet instead of -llibnet.a ; 2) -pthread instead of -lpthread;
CPPFLAGS=-g -std=c++11 $(INC_DIRS)
CXX=g++
TestEchoClient.out: $(TestDir)/TestEchoClient.o $(libname)
$(CXX) ${LDFLAGS} -o $@ $^
@echo " build finished ok !"
TestEchoServer.out: $(TestDir)/TestEchoServer.o $(libname)
$(CXX) ${LDFLAGS} -o $@ $^
@echo " build finished ok !"
$(libname):
cd ./libnet && make -f ./libnet.mk
mv ./libnet/$@ ./
%.o:%.cpp
$(CXX) ${CPPFLAGS} -o $@ -c $^
clean:
rm -rf *.out $(libname)
find ./ -name "*.o" | xargs rm
memcheck:
valgrind --leak-check=full ./TestEchoClient.out 127.0.0.1