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 TESTS
= generateload bounce
37 DEFINES
+= -DSTATISTICS
38 DEFINES
+= -DSTAT_CALLS
39 DEFINES
+= -DRINGBUFFER
40 DEFINES
+= -DHAVE_EPOLL
45 all: programs plugins tests
51 rm -f
*.o
test/*.o
$(PROGRAMS
) $(PLUGINS
) $(TESTS
) 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
)
66 generateload
: test/generateload.o
67 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
70 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
73 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
76 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
79 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
80 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
82 $(INSTALL
) -m
0644 Docs
/startup-config
.5 $(DESTDIR
)$(man5dir)/startup-config
.5
83 $(INSTALL
) -m
0644 Docs
/l2tpns
.8 $(DESTDIR
)$(man8dir)/l2tpns
.8
84 $(INSTALL
) -m
0644 Docs
/nsctl
.8 $(DESTDIR
)$(man8dir)/nsctl
.8
86 gzip
--best
--force $(DESTDIR
)$(man5dir)/*.5 $(DESTDIR
)$(man8dir)/*.8
88 @for config in startup-config users ip_pool
; \
91 mode
=0600; [ $$config = ip_pool
] && mode
=0644; \
92 if
[ -f
$(DESTDIR
)$(etcdir
)/$$config ]; \
94 cmp
-s etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config && continue
; \
97 echo
$(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
98 $(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
101 @for plugin in
$(PLUGINS
); \
103 echo
$(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
104 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
107 @if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; \
110 echo mknod
/dev
/net
/tun c
10 200; \
111 mknod
/dev
/net
/tun c
10 200; \
114 .PHONY
: all clean depend
install
116 ## Dependencies: (autogenerated) ##
117 arp.o
: arp.c l2tpns.h
118 cli.o
: cli.c l2tpns.h util.h cluster.h tbf.h ll.h bgp.h
119 cluster.o
: cluster.c l2tpns.h cluster.h util.h tbf.h bgp.h
120 constants.o
: constants.c constants.h
121 control.o
: control.c l2tpns.h control.h
122 icmp.o
: icmp.c l2tpns.h
123 l2tpns.o
: l2tpns.c md5.h l2tpns.h cluster.h plugin.h ll.h constants.h \
124 control.h util.h tbf.h bgp.h
127 ppp.o
: ppp.c l2tpns.h constants.h plugin.h util.h tbf.h cluster.h
128 radius.o
: radius.c md5.h constants.h l2tpns.h plugin.h util.h
129 tbf.o
: tbf.c l2tpns.h util.h tbf.h
130 util.o
: util.c l2tpns.h bgp.h
131 bgp.o
: bgp.c l2tpns.h bgp.h util.h
132 autosnoop.so
: autosnoop.c l2tpns.h plugin.h
133 autothrottle.so
: autothrottle.c l2tpns.h plugin.h
134 garden.so
: garden.c l2tpns.h plugin.h control.h
135 sessionctl.so
: sessionctl.c l2tpns.h plugin.h control.h
136 setrxspeed.so
: setrxspeed.c l2tpns.h plugin.h
137 snoopctl.so
: snoopctl.c l2tpns.h plugin.h control.h
138 stripdomain.so
: stripdomain.c l2tpns.h plugin.h
139 throttlectl.so
: throttlectl.c l2tpns.h plugin.h control.h