-
Notifications
You must be signed in to change notification settings - Fork 130
/
Makefile
107 lines (89 loc) · 1.81 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
#### User configure ###############
CONFIG_DEBUG = n
CONFIG_DEBUG_PKB = n
CONFIG_DEBUG_WAIT = n
CONFIG_DEBUG_SOCK = n
CONFIG_DEBUG_ARP_LOCK = n
CONFIG_DEBUG_ICMPEXCFRAGTIME = n
CONFIG_TOPLOGY = 2
#### End of User configure #########
# Use 'make V=1' to see the full commands
ifeq ("$(origin V)", "command line")
Q =
else
Q = @
endif
export Q
MAKEFLAGS += --no-print-directory
LD = ld
CC = gcc
CFLAGS = -Wall -I../include
LFLAGS = -pthread
export LD CC CFLAGS
ifeq ($(CONFIG_DEBUG), y)
CFLAGS += -g
endif
ifeq ($(CONFIG_DEBUG), y)
CFLAGS += -DDEBUG_PKB
endif
ifeq ($(CONFIG_DEBUG_SOCK), y)
CFLAGS += -DSOCK_DEBUG
endif
ifeq ($(CONFIG_DEBUG_ICMPEXCFRAGTIME), y)
CFLAGS += -DICMP_EXC_FRAGTIME_TEST
endif
ifeq ($(CONFIG_DEBUG_WAIT), y)
CFLAGS += -DWAIT_DEBUG
endif
ifeq ($(CONFIG_DEBUG_ARP_LOCK), y)
CFLAGS += -DDEBUG_ARPCACHE_LOCK
endif
ifeq ($(CONFIG_TOPLOGY), 1)
CFLAGS += -DCONFIG_TOP1
else
CFLAGS += -DCONFIG_TOP2
endif
NET_STACK_OBJS = shell/shell_obj.o \
net/net_obj.o \
arp/arp_obj.o \
ip/ip_obj.o \
socket/socket_obj.o \
udp/udp_obj.o \
tcp/tcp_obj.o \
app/app_obj.o \
lib/lib_obj.o
all:tapip
tapip:$(NET_STACK_OBJS)
@echo " [BUILD] $@"
$(Q)$(CC) $(LFLAGS) $^ -o $@
shell/shell_obj.o:shell/*.c
@make -C shell/
net/net_obj.o:net/*.c
@make -C net/
arp/arp_obj.o:arp/*.c
@make -C arp/
ip/ip_obj.o:ip/*.c
@make -C ip/
udp/udp_obj.o:udp/*.c
@make -C udp/
tcp/tcp_obj.o:tcp/*.c
@make -C tcp/
lib/lib_obj.o:lib/*.c
@make -C lib/
socket/socket_obj.o:socket/*.c
@make -C socket/
app/app_obj.o:app/*.c
@make -C app/
test:cbuf
# test program for circul buffer
cbuf:lib/cbuf.c lib/lib.c
@echo " [CC] $@"
$(Q)$(CC) -DCBUF_TEST -Iinclude/ $^ -o $@
tag:
ctags -R *
clean:
find . -name *.o | xargs rm -f
rm -f tapip cbuf
lines:
@echo "code lines:"
@wc -l `find . -name \*.[ch]` | sort -n