forked from saminiir/level-ip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (28 loc) · 832 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
CPPFLAGS = -I include -Wall -Werror -pthread
src = $(wildcard src/*.c)
obj = $(patsubst src/%.c, build/%.o, $(src))
headers = $(wildcard include/*.h)
apps = apps/curl/curl
lvl-ip: $(obj)
$(CC) $(CFLAGS) $(CPPFLAGS) $(obj) -o lvl-ip
@echo
@echo "lvl-ip needs CAP_NET_ADMIN:"
sudo setcap cap_setpcap,cap_net_admin=ep lvl-ip
build/%.o: src/%.c ${headers}
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
debug: CFLAGS+= -DDEBUG_SOCKET -DDEBUG_TCP -g -fsanitize=thread
debug: lvl-ip
apps: $(apps)
$(MAKE) -C tools
$(MAKE) -C apps/curl
$(MAKE) -C apps/curl-poll
all: lvl-ip apps
test: debug apps
@echo
@echo "Networking capabilites are required for test dependencies:"
which arping | sudo xargs setcap cap_net_raw=ep
which tc | sudo xargs setcap cap_net_admin=ep
@echo
cd tests && ./test-run-all
clean:
rm build/*.o lvl-ip