4 libdir = /usr
/lib
/l2tpns
5 man5dir = /usr
/share
/man
/man5
6 man8dir = /usr
/share
/man
/man8
7 statedir = /var
/lib
/l2tpns
10 DEFINES
+= -DSTATISTICS
11 DEFINES
+= -DSTAT_CALLS
12 DEFINES
+= -DRINGBUFFER
14 DEFINES
+= -DLIBDIR
='"$(libdir)"'
15 DEFINES
+= -DETCDIR
='"$(etcdir)"'
16 DEFINES
+= -DSTATEDIR
='"$(statedir)"'
20 OPTIM
+= -funroll-loops
21 OPTIM
+= -fomit-frame-pointer
22 OPTIM
+= -finline-functions
23 #OPTIM += -fstrength-reduce
28 CPPFLAGS
= $(INCLUDES
) $(DEFINES
)
29 CFLAGS
= -Wall
$(OPTIM
)
32 INSTALL
= install -c
-D
-o root
-g root
49 PLUGINS
= garden.so autothrottle.so autosnoop.so stripdomain.so setrxspeed.so
50 TARGETS
= l2tpns nsctl generateload bounce
$(PLUGINS
)
55 rm -f
*.o
test/*.o
$(TARGETS
) Makefile.tmp Makefile.bak
58 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
59 gcc
-MM
$(CPPFLAGS
) $(OBJS
:.o
=.c
) && \
60 gcc
-MM
$(CPPFLAGS
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
61 mv Makefile Makefile.bak
62 mv Makefile.tmp Makefile
65 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) -lcli
-ldl
67 nsctl
: nsctl.o control.o
68 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
)
70 generateload
: test/generateload.o
71 $(LD
) $(LDFLAGS
) -o
$@
$^
# -lpthread
74 $(LD
) $(LDFLAGS
) -o
$@
$^
77 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
80 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
82 # install config files only if a startup-config does not exist yet
83 # this does not interfere when building rpms or debs and makes
84 # fast upgrading via make install possible
87 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
88 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
90 $(INSTALL
) -m
0644 Docs
/startup-config
.5 $(DESTDIR
)$(man5dir)/startup-config
.5
91 $(INSTALL
) -m
0644 Docs
/l2tpns
.8 $(DESTDIR
)$(man8dir)/l2tpns
.8
92 $(INSTALL
) -m
0644 Docs
/nsctl
.8 $(DESTDIR
)$(man8dir)/nsctl
.8
94 gzip
$(DESTDIR
)$(man5dir)/*.5 $(DESTDIR
)$(man8dir)/*.8
96 @if
[ -f
$(DESTDIR
)$(etcdir
)/startup-config
]; then \
97 echo
'***' Installing default config files in
$(DESTDIR
)$(etcdir
) as .defaults
; \
100 echo
'***' Installing default config files in
$(DESTDIR
)$(etcdir
) - remember to adjust them
; \
103 $(INSTALL
) -m
0600 etc
/startup-config.default
$(DESTDIR
)$(etcdir
)/startup-config
$$suffix; \
104 $(INSTALL
) -m
0644 etc
/ip_pool.default
$(DESTDIR
)$(etcdir
)/ip_pool
$$suffix; \
105 $(INSTALL
) -m
0600 etc
/users.default
$(DESTDIR
)$(etcdir
)/users
$$suffix
107 for plugin in
$(PLUGINS
); do \
108 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
111 if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; then \
113 mknod
/dev
/net
/tun c
10 200; \
116 .PHONY
: all clean depend
install
118 ## Dependencies: (autogenerated) ##
119 arp.o
: arp.c l2tpns.h
120 bgp.o
: bgp.c l2tpns.h bgp.h util.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 garden.so
: garden.c l2tpns.h plugin.h control.h
135 autothrottle.so
: autothrottle.c l2tpns.h plugin.h
136 autosnoop.so
: autosnoop.c l2tpns.h plugin.h
137 stripdomain.so
: stripdomain.c l2tpns.h plugin.h
138 setrxspeed.so
: setrxspeed.c l2tpns.h plugin.h