-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
59 lines (49 loc) · 1.57 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 ?= clang
LDOPTS += -Wl,-z,now -Wl,-z,relro
COPTSWARN = -Wall -Wextra -Wno-unused-parameter -Wpointer-arith
COPTSSEC = -D_FORTIFY_SOURCE=2
ifeq ($(CC), clang)
COPTSSEC+=-fstack-protector-strong
else
COPTSSEC+=-fstack-protector
endif
COPTSDEBUG=-g -ggdb -O3
ifeq ($(BUILD), debugaddress)
COPTSDEBUG=-g -ggdb -O0 -fsanitize=address -fsanitize=undefined
endif
ifeq ($(BUILD), release)
MARCH=-march=corei7
COPTSDEBUG=-g -ggdb -O3 $(MARCH)
endif
COPTS+=$(CFLAGS) $(COPTSDEBUG) $(COPTSWARN) $(COPTSSEC) -fPIE \
-Ilibmill -Ilibseccomp/include
.PHONY: all
all: mmproxy
mmproxy: libmill/.libs/libmill.a libseccomp/src/.libs/libseccomp.a src/*.[ch] Makefile
$(CC) $(COPTS) \
src/main.c \
src/utils.c \
src/net.c \
libmill/.libs/libmill.a \
libseccomp/src/.libs/libseccomp.a \
$(LDOPTS) \
-o mmproxy -static
libmill/.libs/libmill.a: libmill/*c
-$(MAKE) -C libmill distclean
if [ ! -e libmill/configure ]; then (cd libmill && ./autogen.sh); fi
(cd libmill && \
./configure CC="$(CC)" CFLAGS="$(CFLAGS) -fPIE $(COPTSDEBUG)")
$(MAKE) -C libmill libmill.la
libseccomp/src/.libs/libseccomp.a: libseccomp/src/*c
-$(MAKE) -C libseccomp distclean
if [ ! -e libseccomp/configure ]; then (cd libseccomp && ./autogen.sh); fi
(cd libseccomp && \
./configure CC="$(CC)" CFLAGS="$(CFLAGS) -fPIE $(COPTSDEBUG)")
$(MAKE) -C libseccomp
.PHONY: format
format:
clang-format -i src/*.c
@grep -n "TODO" src/*.[ch]
.PHONY: cloudflare-ip-ranges.txt
cloudflare-ip-ranges.txt:
curl -s https://www.cloudflare.com/ips-v4 https://www.cloudflare.com/ips-v6 | sort > cloudflare-ip-ranges.txt