-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
76 lines (58 loc) · 1.7 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
CC=gcc
LWIP?=$(HOME)/src/lwip
CFLAGS=-fno-stack-protector -Wall -O2 -g -D_GNU_SOURCE -fPIC
CFLAGS+=-I$(LWIP)/src/include/ipv4 -I$(LWIP)/src/include/ipv6
CFLAGS+=-I$(LWIP)/src/include
JAVA_32=$(shell java -d64 -version 2>&1 |\
grep -q "is not supported on this platform" && echo -m32)
LIB_SOURCES=\
fd.c \
fd_info.c \
files.c \
fopen.c \
ioctl.c \
ioctl_sockios.c \
signal.c \
socket.c \
uid.c \
system.c
NCSVC_SOURCES=\
md5.c \
ncsvc_packet.c \
ping.c \
preload_ncsvc.c \
route.c \
resolv.c \
ncsvc_main.c \
log.c
TNCC_SOURCES=\
preload_tncc.c
LIB_OBJS=$(LIB_SOURCES:.c=.o)
_NCSVC_OBJS=$(NCSVC_SOURCES:.c=.o)
_TNCC_OBJS=$(TNCC_SOURCES:.c=.o)
NCSVC_OBJDIR=ncsvc_build
TNCC_OBJDIR=tncc_build
NCSVC_OBJS=$(addprefix $(NCSVC_OBJDIR)/,$(LIB_OBJS) $(_NCSVC_OBJS))
TNCC_OBJS=$(addprefix $(TNCC_OBJDIR)/,$(LIB_OBJS) $(_TNCC_OBJS))
LIBS=-L. -L$(LWIP) -ldl -levent_core -lpthread -ltunsock -nostdlib -lpcap
all: $(NCSVC_OBJDIR)/ncsvc_preload.so $(TNCC_OBJDIR)/tncc_preload.so
$(NCSVC_OBJDIR):
mkdir -p $@
$(TNCC_OBJDIR):
mkdir -p $@
$(NCSVC_OBJS): | $(NCSVC_OBJDIR)
$(TNCC_OBJS): | $(TNCC_OBJDIR)
$(NCSVC_OBJDIR)/ncsvc_preload.so: $(NCSVC_OBJS) | $(NCSVC_OBJDIR)
$(CC) $(CFLAGS) $(LDFLAGS) -m32 -shared -Wl,-soname,$@ -o $@ $^ $(LIBS)
$(TNCC_OBJDIR)/tncc_preload.so: $(TNCC_OBJS) | $(TNCC_OBJDIR)
$(CC) $(CFLAGS) $(LDFLAGS) $(JAVA_32) -shared -Wl,-soname,$@ -o $@ $^ -ldl
$(NCSVC_OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) -DAPP_NAME=\"ncsvc\" -m32 -c $< -o $@
$(TNCC_OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) -DAPP_NAME=\"tncc\" $(JAVA_32) -c $< -o $@
DESTDIR=$(HOME)/.juniper_networks
install: all
mkdir -p $(DESTDIR)
cp $(NCSVC_OBJDIR)/ncsvc_preload.so $(TNCC_OBJDIR)/tncc_preload.so $(DESTDIR)
clean:
-rm -rf $(NCSVC_OBJDIR) $(TNCC_OBJDIR)