-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
48 lines (39 loc) · 1.26 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
BADVPNDIR = badvpn
LWIPDIR ?= $(BADVPNDIR)/lwip
INCLUDES = -I$(BADVPNDIR) -I$(LWIPDIR)/src/include/ipv4 -I$(LWIPDIR)/src/include/ipv6 -I$(LWIPDIR)/src/include -I$(LWIPDIR)/custom
CC ?= gcc
AR ?= ar
LIBS ?= -lrt -lpthread
LOCAL_CFLAGS = -std=gnu99
LOCAL_CFLAGS += -DBADVPN_THREAD_SAFE=0 -DBADVPN_LINUX -DBADVPN_BREACTOR_BADVPN -D_GNU_SOURCE
LOCAL_CFLAGS += -DBADVPN_USE_EPOLL -DBADVPN_USE_SELFPIPE
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN
ENDIAN = little
OBJDIR = ./obj
libtun2io: deps main
docker-android-libtun2io:
GCCBIN=/pkg/gomobile/android-ndk-r10e/arm/bin \
LIBS="" \
CC=$$GCCBIN/arm-linux-androideabi-gcc \
AR=$$GCCBIN/arm-linux-androideabi-ar \
make lib
lib: deps
mkdir -p lib && \
$(CC) -fpic -c $(LOCAL_CFLAGS) $(INCLUDES) $(LDFLAGS) tun2io.c $(LIBS) && \
$(CC) -shared -o lib/libtun2io.so tun2io.o $(OBJDIR)/*.o $(LIBS)
$(AR) rcs lib/libtun2io.a tun2io.o $(OBJDIR)/*.o
deps:
mkdir -p $(OBJDIR) && \
for f in $$(cat compile.list | grep -v "^#"); do \
o=$$(basename "$$f" .c).o && \
$(CC) -fpic -c $(LOCAL_CFLAGS) $(INCLUDES) $(BADVPNDIR)/$$f -o $(OBJDIR)/$$o $(LIBS) && \
echo "-> $(OBJDIR)/$$o"; \
done
binary: lib
go get -d && \
go install github.com/getlantern/tunio/cmd/tunio
clean:
rm -f $(OBJDIR)/*.o
rm -f lib/*
rm -f *.o
.PHONY: libtun2io