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
41 ifneq (2.4, $(shell uname
-r | perl
-pe
's/^(\d+\.\d+).*/$$1/'))
42 DEFINES
+= -DHAVE_EPOLL
48 all: programs plugins tests
54 rm -f
*.o
test/*.o
$(PROGRAMS
) $(PLUGINS
) $(TESTS
) Makefile.tmp Makefile.bak
57 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
58 gcc
-MM
$(CPPFLAGS
) $(OBJS
:.o
=.c
) && \
59 gcc
-MM
$(CPPFLAGS
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
60 mv Makefile Makefile.bak
61 mv Makefile.tmp Makefile
64 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
66 nsctl
: nsctl.o control.o
67 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
69 generateload
: test/generateload.o
70 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
73 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
76 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
79 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
82 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
83 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
85 $(INSTALL
) -m
0644 Docs
/startup-config
.5 $(DESTDIR
)$(man5dir)/startup-config
.5
86 $(INSTALL
) -m
0644 Docs
/l2tpns
.8 $(DESTDIR
)$(man8dir)/l2tpns
.8
87 $(INSTALL
) -m
0644 Docs
/nsctl
.8 $(DESTDIR
)$(man8dir)/nsctl
.8
89 gzip
--best
--force $(DESTDIR
)$(man5dir)/*.5 $(DESTDIR
)$(man8dir)/*.8
91 @for config in startup-config users ip_pool
; \
94 mode
=0600; [ $$config = ip_pool
] && mode
=0644; \
95 if
[ -f
$(DESTDIR
)$(etcdir
)/$$config ]; \
97 cmp
-s etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config && continue
; \
100 echo
$(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
101 $(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
104 @for plugin in
$(PLUGINS
); \
106 echo
$(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
107 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
110 @if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; \
113 echo mknod
/dev
/net
/tun c
10 200; \
114 mknod
/dev
/net
/tun c
10 200; \
117 .PHONY
: all clean depend
install
119 ## Dependencies: (autogenerated) ##
120 arp.o
: arp.c l2tpns.h
121 cli.o
: cli.c l2tpns.h util.h cluster.h tbf.h ll.h bgp.h
122 cluster.o
: cluster.c l2tpns.h cluster.h util.h tbf.h bgp.h
123 constants.o
: constants.c constants.h
124 control.o
: control.c l2tpns.h control.h
125 icmp.o
: icmp.c l2tpns.h
126 l2tpns.o
: l2tpns.c md5.h l2tpns.h cluster.h plugin.h ll.h constants.h \
127 control.h util.h tbf.h bgp.h
130 ppp.o
: ppp.c l2tpns.h constants.h plugin.h util.h tbf.h cluster.h
131 radius.o
: radius.c md5.h constants.h l2tpns.h plugin.h util.h
132 tbf.o
: tbf.c l2tpns.h util.h tbf.h
133 util.o
: util.c l2tpns.h bgp.h
134 bgp.o
: bgp.c l2tpns.h bgp.h util.h
135 autosnoop.so
: autosnoop.c l2tpns.h plugin.h
136 autothrottle.so
: autothrottle.c l2tpns.h plugin.h
137 garden.so
: garden.c l2tpns.h plugin.h control.h
138 sessionctl.so
: sessionctl.c l2tpns.h plugin.h control.h
139 setrxspeed.so
: setrxspeed.c l2tpns.h plugin.h
140 snoopctl.so
: snoopctl.c l2tpns.h plugin.h control.h
141 stripdomain.so
: stripdomain.c l2tpns.h plugin.h
142 throttlectl.so
: throttlectl.c l2tpns.h plugin.h control.h