-
Notifications
You must be signed in to change notification settings - Fork 66
/
Makefile
59 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
57
58
59
CC ?= gcc
OUT ?= build
CFLAGS := -Wall -Wextra -Wno-unused-parameter -g
CFLAGS += --std=gnu99 -pthread
CFLAGS += -include config.h -I include
SRC = src
OBJS_core := \
arp.o \
ether.o \
ether_fcs.o \
icmp.o \
ip.o \
ip_defer.o \
ip_fragment.o \
ip_route.o \
tcp.o \
udp.o \
nstack.o \
linux/ether.o
OBJS_core := $(addprefix $(OUT)/, $(OBJS_core))
OBJS_socket := \
socket.o
OBJS_socket := $(addprefix $(OUT)/, $(OBJS_socket))
OBJS := $(OBJS_core) $(OBJS_socket)
deps := $(OBJS:%.o=%.o.d)
SHELL_HACK := $(shell mkdir -p $(OUT))
SHELL_HACK := $(shell mkdir -p $(OUT)/linux)
EXEC = $(OUT)/inetd $(OUT)/tnetcat $(OUT)/unetcat $(OUT)/tcptest
all: $(EXEC)
$(OUT)/%.o: $(SRC)/%.c
$(CC) -o $@ $(CFLAGS) -c -MMD -MF [email protected] $<
$(OUT)/inetd: $(OBJS_core)
$(CC) $(CFLAGS) -o $@ $^
$(OUT)/tnetcat: $(OBJS_socket)
$(CC) $(CFLAGS) -o $@ tests/tnetcat.c $^
$(OUT)/unetcat: $(OBJS_socket)
$(CC) $(CFLAGS) -o $@ tests/unetcat.c $^
$(OUT)/tcptest: $(OBJS_socket)
$(CC) $(CFLAGS) -o $@ tests/tcptest.c $^
clean:
$(RM) $(EXEC) $(OBJS) $(deps)
distclean: clean
$(RM) -r $(OUT)
-include $(deps)