forked from pandax381/microps
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (41 loc) · 959 Bytes
/
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
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_socket.o raw_tap.o
CFLAGS := $(CFLAGS) -lpthread -pthread -DHAVE_TAP
endif
ifeq ($(shell uname),Darwin)
OBJS := $(OBJS) raw_bpf.o
# OBJS := $(OBJS) raw_tap.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)