4 libdir = /usr
/lib
/l2tpns
5 man5dir = /usr
/share
/man
/man5
6 man8dir = /usr
/share
/man
/man8
7 statedir = /var
/lib
/l2tpns
10 DEFINES
+= -DLIBDIR
='"$(libdir)"'
11 DEFINES
+= -DETCDIR
='"$(etcdir)"'
20 CPPFLAGS
= $(INCLUDES
) $(DEFINES
)
21 CFLAGS
= -Wall
-Wformat-security
-Wno-format-zero-length
$(OPTIM
)
24 INSTALL
= install -c
-D
-o root
-g root
26 l2tpns.LIBS
= -lm
-lcli
-ldl
28 OBJS
= arp.o cli.o cluster.o constants.o control.o icmp.o l2tpns.o \
29 ll.o md5.o ppp.o radius.o tbf.o util.o
31 PROGRAMS
= l2tpns nsctl
32 PLUGINS
= autosnoop.so autothrottle.so garden.so sessionctl.so \
33 setrxspeed.so snoopctl.so stripdomain.so throttlectl.so
35 DEFINES
+= -DSTATISTICS
36 DEFINES
+= -DSTAT_CALLS
37 DEFINES
+= -DRINGBUFFER
39 ifneq (2.4, $(shell uname
-r | perl
-pe
's/^(\d+\.\d+).*/$$1/'))
40 DEFINES
+= -DHAVE_EPOLL
51 rm -f
*.o
test/*.o
$(PROGRAMS
) $(PLUGINS
) Makefile.tmp Makefile.bak
54 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
55 gcc
-MM
$(CPPFLAGS
) $(OBJS
:.o
=.c
) && \
56 gcc
-MM
$(CPPFLAGS
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
57 mv Makefile Makefile.bak
58 mv Makefile.tmp Makefile
61 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
63 nsctl
: nsctl.o control.o
64 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
67 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
70 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
73 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
74 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
76 $(INSTALL
) -m
0644 Docs
/startup-config
.5 $(DESTDIR
)$(man5dir)/startup-config
.5
77 $(INSTALL
) -m
0644 Docs
/l2tpns
.8 $(DESTDIR
)$(man8dir)/l2tpns
.8
78 $(INSTALL
) -m
0644 Docs
/nsctl
.8 $(DESTDIR
)$(man8dir)/nsctl
.8
80 gzip
--best
--force $(DESTDIR
)$(man5dir)/*.5 $(DESTDIR
)$(man8dir)/*.8
82 @for config in startup-config users ip_pool
; \
85 mode
=0600; [ $$config = ip_pool
] && mode
=0644; \
86 if
[ -f
$(DESTDIR
)$(etcdir
)/$$config ]; \
88 cmp
-s etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config && continue
; \
91 echo
$(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
92 $(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
95 @for plugin in
$(PLUGINS
); \
97 echo
$(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
98 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
101 @if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; \
104 echo mknod
/dev
/net
/tun c
10 200; \
105 mknod
/dev
/net
/tun c
10 200; \
108 .PHONY
: all clean depend
install
110 ## Dependencies: (autogenerated) ##
111 arp.o
: arp.c l2tpns.h
112 cli.o
: cli.c l2tpns.h util.h cluster.h tbf.h ll.h bgp.h
113 cluster.o
: cluster.c l2tpns.h cluster.h util.h tbf.h bgp.h
114 constants.o
: constants.c constants.h
115 control.o
: control.c l2tpns.h control.h
116 icmp.o
: icmp.c l2tpns.h
117 l2tpns.o
: l2tpns.c md5.h l2tpns.h cluster.h plugin.h ll.h constants.h \
118 control.h util.h tbf.h bgp.h
121 ppp.o
: ppp.c l2tpns.h constants.h plugin.h util.h tbf.h cluster.h
122 radius.o
: radius.c md5.h constants.h l2tpns.h plugin.h util.h
123 tbf.o
: tbf.c l2tpns.h util.h tbf.h
124 util.o
: util.c l2tpns.h bgp.h
125 bgp.o
: bgp.c l2tpns.h bgp.h util.h
126 autosnoop.so
: autosnoop.c l2tpns.h plugin.h
127 autothrottle.so
: autothrottle.c l2tpns.h plugin.h
128 garden.so
: garden.c l2tpns.h plugin.h control.h
129 sessionctl.so
: sessionctl.c l2tpns.h plugin.h control.h
130 setrxspeed.so
: setrxspeed.c l2tpns.h plugin.h
131 snoopctl.so
: snoopctl.c l2tpns.h plugin.h control.h
132 stripdomain.so
: stripdomain.c l2tpns.h plugin.h
133 throttlectl.so
: throttlectl.c l2tpns.h plugin.h control.h