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)"'
13 DEB_CFLAGS_MAINT_APPEND
=-Wall
-O3
-Wno-format-zero-length
18 CPPFLAGS
= `dpkg-buildflags --get CPPFLAGS` $(INCLUDES
) $(DEFINES
)
19 CFLAGS
= `dpkg-buildflags --get CFLAGS`
20 LDFLAGS
= `dpkg-buildflags --get LDFLAGS`
22 INSTALL
= install -c
-D
-o root
-g root
24 l2tpns.LIBS
= -lcli
-ldl
26 OBJS
= arp.o cli.o cluster.o constants.o control.o icmp.o l2tpns.o \
27 ll.o md5.o ppp.o radius.o tbf.o util.o pppoe.o l2tplac.o
29 PROGRAMS
= l2tpns nsctl
30 PLUGINS
= autosnoop.so autothrottle.so garden.so sessionctl.so \
31 setrxspeed.so snoopctl.so stripdomain.so throttlectl.so
33 DEFINES
+= -DSTATISTICS
34 DEFINES
+= -DSTAT_CALLS
35 DEFINES
+= -DRINGBUFFER
37 ifneq (2.4, $(shell uname
-r | perl
-pe
's/^(\d+\.\d+).*/$$1/'))
38 DEFINES
+= -DHAVE_EPOLL
49 rm -f
*.o
test/*.o
$(PROGRAMS
) $(PLUGINS
) Makefile.tmp Makefile.bak
52 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
53 gcc
-MM
$(CPPFLAGS
) $(OBJS
:.o
=.c
) && \
54 gcc
-MM
$(CPPFLAGS
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
55 mv Makefile Makefile.bak
56 mv Makefile.tmp Makefile
59 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
61 nsctl
: nsctl.o control.o
62 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) $($@.LIBS
)
65 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
68 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
71 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
72 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
74 $(INSTALL
) -m
0644 Docs
/startup-config
.5 $(DESTDIR
)$(man5dir)/startup-config
.5
75 $(INSTALL
) -m
0644 Docs
/l2tpns
.8 $(DESTDIR
)$(man8dir)/l2tpns
.8
76 $(INSTALL
) -m
0644 Docs
/nsctl
.8 $(DESTDIR
)$(man8dir)/nsctl
.8
78 gzip
--best
--force $(DESTDIR
)$(man5dir)/*.5 $(DESTDIR
)$(man8dir)/*.8
80 @for config in startup-config users ip_pool
; \
83 mode
=0600; [ $$config = ip_pool
] && mode
=0644; \
84 if
[ -f
$(DESTDIR
)$(etcdir
)/$$config ]; \
86 cmp
-s etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config && continue
; \
89 echo
$(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
90 $(INSTALL
) -m
$$mode etc
/$$config.default
$(DESTDIR
)$(etcdir
)/$$config$$suffix; \
93 @for plugin in
$(PLUGINS
); \
95 echo
$(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
96 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
99 @if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; \
102 echo mknod
/dev
/net
/tun c
10 200; \
103 mknod
/dev
/net
/tun c
10 200; \
106 .PHONY
: all clean depend
install
108 ## Dependencies: (autogenerated) ##
109 arp.o
: arp.c l2tpns.h
110 cli.o
: cli.c l2tpns.h constants.h util.h cluster.h tbf.h ll.h bgp.h \
112 cluster.o
: cluster.c l2tpns.h cluster.h util.h tbf.h pppoe.h bgp.h
113 constants.o
: constants.c constants.h
114 control.o
: control.c l2tpns.h control.h
115 icmp.o
: icmp.c l2tpns.h pppoe.h
116 l2tpns.o
: l2tpns.c md5.h l2tpns.h cluster.h plugin.h ll.h constants.h \
117 control.h util.h tbf.h bgp.h l2tplac.h pppoe.h
120 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 cluster.h \
124 tbf.o
: tbf.c l2tpns.h util.h tbf.h
125 util.o
: util.c l2tpns.h bgp.h
126 pppoe.o
: pppoe.c l2tpns.h cluster.h constants.h md5.h util.h
127 l2tplac.o
: l2tplac.c md5.h l2tpns.h util.h cluster.h l2tplac.h pppoe.h
128 bgp.o
: bgp.c l2tpns.h bgp.h util.h
129 autosnoop.so
: autosnoop.c l2tpns.h plugin.h
130 autothrottle.so
: autothrottle.c l2tpns.h plugin.h
131 garden.so
: garden.c l2tpns.h plugin.h control.h
132 sessionctl.so
: sessionctl.c l2tpns.h plugin.h control.h
133 setrxspeed.so
: setrxspeed.c l2tpns.h plugin.h
134 snoopctl.so
: snoopctl.c l2tpns.h plugin.h control.h
135 stripdomain.so
: stripdomain.c l2tpns.h plugin.h
136 throttlectl.so
: throttlectl.c l2tpns.h plugin.h control.h