forked from chenshuo/4.4BSD-Lite2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (61 loc) · 1.72 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
CC = gcc
CFLAGS = -g3 -ggdb -Wall -O0 -m32 -Werror=implicit-function-declaration -fcommon
OBJDIR := objs
BINS := test_init test_pigeon test_self test_tun
SRCS= \
sys/kern/kern_subr.c \
sys/kern/uipc_domain.c \
sys/kern/uipc_mbuf.c \
sys/kern/uipc_socket.c \
sys/kern/uipc_socket2.c \
sys/kern/sys_socket.c \
sys/net/if.c \
sys/net/if_ethersubr.c \
sys/net/if_loop.c \
sys/net/radix.c \
sys/net/route.c \
sys/netinet/if_ether.c \
sys/netinet/igmp.c \
sys/netinet/in.c \
sys/netinet/in_cksum.c \
sys/netinet/in_pcb.c \
sys/netinet/in_proto.c \
sys/netinet/ip_icmp.c \
sys/netinet/ip_input.c \
sys/netinet/ip_output.c \
sys/netinet/raw_ip.c \
sys/netinet/tcp_debug.c \
sys/netinet/tcp_input.c \
sys/netinet/tcp_output.c \
sys/netinet/tcp_subr.c \
sys/netinet/tcp_timer.c \
sys/netinet/tcp_usrreq.c \
sys/netinet/udp_usrreq.c \
lib/handshake.c \
lib/if_pigeon.c \
lib/if_tun.c \
lib/ip_intercept.c \
lib/init.c \
lib/ping.c \
lib/stub.c
LIB = $(OBJDIR)/libkern.a
all: $(addprefix $(OBJDIR)/,$(BINS))
$(OBJDIR)/test_%: tests/%.c $(LIB)
$(CC) $(CFLAGS) $< $(LIB) -o $@
$(OBJDIR)/%.o:%.c
$(CC) $(CFLAGS) $(KERNFLAGS) -c $< -o $@
KERNOBJS := $(addprefix $(OBJDIR)/,$(SRCS:.c=.o))
$(KERNOBJS): KERNFLAGS = -nostdinc -fno-builtin -DKERNEL -DINET -I sys
$(OBJDIR)/lib/handshake.o: CFLAGS += -Wno-parentheses
$(LIB): $(KERNOBJS) $(OBJDIR)/tools/pcap.o
ar rcs $@ $^
$(KERNOBJS): | $(OBJDIR)
$(OBJDIR):
mkdir -p $(OBJDIR)
mkdir -p $(OBJDIR)/lib
mkdir -p $(OBJDIR)/sys/kern
mkdir -p $(OBJDIR)/sys/net
mkdir -p $(OBJDIR)/sys/netinet
mkdir -p $(OBJDIR)/tools
clean:
rm -rf $(OBJDIR)