4 libdir = /usr
/lib
/l2tpns
5 mandir = /usr
/share
/man
/man8
6 statedir = /var
/lib
/l2tpns
9 DEFINES
+= -DSTATISTICS
10 DEFINES
+= -DSTAT_CALLS
11 DEFINES
+= -DRINGBUFFER
13 DEFINES
+= -DLIBDIR
='"$(libdir)"'
14 DEFINES
+= -DETCDIR
='"$(etcdir)"'
15 DEFINES
+= -DSTATEDIR
='"$(statedir)"'
19 OPTIM
+= -funroll-loops
20 OPTIM
+= -fomit-frame-pointer
21 OPTIM
+= -finline-functions
22 #OPTIM += -fstrength-reduce
27 CPPFLAGS
= $(INCLUDES
) $(DEFINES
)
28 CFLAGS
= -Wall
$(OPTIM
)
31 INSTALL
= install -c
-D
-o root
-g root
48 PLUGINS
= garden.so autothrottle.so autosnoop.so stripdomain.so setrxspeed.so
49 TARGETS
= l2tpns nsctl generateload bounce
$(PLUGINS
)
54 rm -f
*.o
test/*.o
$(TARGETS
) 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
) -lcli
-ldl
66 nsctl
: nsctl.o control.o
67 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
)
69 generateload
: test/generateload.o
70 $(LD
) $(LDFLAGS
) -o
$@
$^
# -lpthread
73 $(LD
) $(LDFLAGS
) -o
$@
$^
76 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
79 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
81 # install config files only if a startup-config does not exist yet
82 # this does not interfere when building rpms or debs and makes
83 # fast upgrading via make install possible
86 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
87 $(INSTALL
) -m
0644 l2tpns
.8 $(DESTDIR
)$(mandir)/l2tpns
.8
88 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
89 $(INSTALL
) -m
0644 nsctl
.8 $(DESTDIR
)$(mandir)/nsctl
.8
90 @if
[ -f
$(DESTDIR
)$(etcdir
)/startup-config
]; then \
91 echo
'***' Installing default config files in
$(DESTDIR
)$(etcdir
) as .defaults
; \
94 echo
'***' Installing default config files in
$(DESTDIR
)$(etcdir
) - remember to adjust them
; \
97 $(INSTALL
) -m
0600 etc
/startup-config.default
$(DESTDIR
)$(etcdir
)/startup-config
$$suffix; \
98 $(INSTALL
) -m
0644 etc
/ip_pool.default
$(DESTDIR
)$(etcdir
)/ip_pool
$$suffix; \
99 $(INSTALL
) -m
0600 etc
/users.default
$(DESTDIR
)$(etcdir
)/users
$$suffix
101 for plugin in
$(PLUGINS
); do \
102 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
105 if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; then \
107 mknod
/dev
/net
/tun c
10 200; \
110 .PHONY
: all clean depend
install
112 ## Dependencies: (autogenerated) ##
113 arp.o
: arp.c l2tpns.h
114 bgp.o
: bgp.c l2tpns.h bgp.h util.h
115 cli.o
: cli.c l2tpns.h util.h cluster.h tbf.h ll.h bgp.h
116 cluster.o
: cluster.c l2tpns.h cluster.h util.h tbf.h bgp.h
117 constants.o
: constants.c constants.h
118 control.o
: control.c control.h
119 icmp.o
: icmp.c l2tpns.h
120 l2tpns.o
: l2tpns.c md5.h l2tpns.h cluster.h plugin.h ll.h constants.h \
121 control.h util.h tbf.h bgp.h
124 ppp.o
: ppp.c l2tpns.h constants.h plugin.h util.h tbf.h cluster.h
125 radius.o
: radius.c md5.h constants.h l2tpns.h plugin.h util.h
126 tbf.o
: tbf.c l2tpns.h util.h tbf.h
127 util.o
: util.c l2tpns.h bgp.h
128 garden.so
: garden.c l2tpns.h plugin.h control.h
129 autothrottle.so
: autothrottle.c l2tpns.h plugin.h
130 autosnoop.so
: autosnoop.c l2tpns.h plugin.h
131 stripdomain.so
: stripdomain.c l2tpns.h plugin.h
132 setrxspeed.so
: setrxspeed.c l2tpns.h plugin.h