forked from pandax381/microps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (44 loc) · 1.08 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
APPS = apps/tcp_echo \
apps/udp_echo \
apps/router
TEST = test/raw_test \
test/ethernet_test \
test/slip_test \
test/arp_test
OBJS = util.o \
raw.o \
net.o \
ethernet.o \
slip.o \
arp.o \
ip.o \
icmp.o \
udp.o \
tcp.o \
dhcp.o \
microps.o
CFLAGS := $(CFLAGS) -g -W -Wall -Wno-unused-parameter -I .
ifeq ($(shell uname),Linux)
OBJS := $(OBJS) raw/soc.o raw/tap_linux.o
TEST := $(TEST) test/raw_soc_test test/raw_tap_test
CFLAGS := $(CFLAGS) -pthread -DHAVE_PF_PACKET -DHAVE_TAP
endif
ifeq ($(shell uname),Darwin)
OBJS := $(OBJS) raw/bpf.o
TEST := $(TEST) test/raw_bpf_test.o
# OBJS := $(OBJS) raw/tap_bsd.o
# TEST := $(TEST) test/raw_tap_test.o
# CFLAGS := $(CFLAGS) -DHAVE_TAP
endif
.SUFFIXES:
.SUFFIXES: .c .o
.PHONY: all clean
all: $(APPS) $(TEST)
$(APPS): % : %.o $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(TEST): % : %.o $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(APPS) $(APPS:=.o) $(OBJS) $(TEST) $(TEST:=.o)