-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
73 lines (50 loc) · 1.58 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
# usage :
# make -f makefile
# make -f makefile clean
dir_inc_jansson = /usr/include
dir_lib_jansson = /usr/lib/
INC = -I$(dir_inc_jansson)
LIB = -L$(dir_lib_jansson) -ljansson
dir_bin = .
SRC1 = socket.cc
SRC2 = http.cc
SRC3 = ftp.cc
SRC_MAIN1 = tcp_client_01.cc
SRC_MAIN2 = tcp_server_01.cc
SRC_MAIN3 = http_client.cc
OBJ1 = socket.o
OBJ2 = http.o
OBJ3 = ftp.o
OBJ_MAIN1 = tcp_client_01.o
OBJ_MAIN2 = tcp_server_01.o
OBJ_MAIN3 = http_client.o
EXE1 = $(dir_bin)/tcp_client_01
EXE2 = $(dir_bin)/tcp_server_01
EXE3 = $(dir_bin)/http_client
OBJs = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN1) $(OBJ_MAIN2) $(OBJ_MAIN3)
EXEs = $(EXE1) $(EXE2) $(EXE3)
CXX = g++
CXX_FLAG = -g -Wall -std=c++0x
LINK_FLAG = -lstdc++
all: $(EXEs)
test : run1
$(EXE1) : $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN1)
$(CXX) $(LINK_FLAG) -o $(EXE1) $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN1) $(LIB)
$(EXE2) : $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN2)
$(CXX) $(LINK_FLAG) -o $(EXE2) $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN2) $(LIB)
$(EXE3) : $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN3)
$(CXX) $(LINK_FLAG) -o $(EXE3) $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ_MAIN3) $(LIB)
$(OBJ1) : $(SRC1)
$(CXX) $(INC) $(CXX_FLAG) -c $(SRC1) -o $(OBJ1)
$(OBJ2) : $(SRC2)
$(CXX) $(INC) $(CXX_FLAG) -c $(SRC2) -o $(OBJ2)
$(OBJ3) : $(SRC3)
$(CXX) $(INC) $(CXX_FLAG) -c $(SRC3) -o $(OBJ3)
$(OBJ_MAIN1) : $(SRC_MAIN1)
$(CXX) $(INC) $(CXX_FLAG) -c $(SRC_MAIN1) -o $(OBJ_MAIN1)
$(OBJ_MAIN2) : $(SRC_MAIN2)
$(CXX) $(INC) $(CXX_FLAG) -c $(SRC_MAIN2) -o $(OBJ_MAIN2)
$(OBJ_MAIN3) : $(SRC_MAIN3)
$(CXX) $(INC) $(CXX_FLAG) -c $(SRC_MAIN3) -o $(OBJ_MAIN3)
clean:
rm -f $(OBJs) $(EXEs)