4 libdir = /usr
/lib
/l2tpns
5 statedir = /var
/lib
/l2tpns
8 DEFINES
+= -DSTATISTICS
9 DEFINES
+= -DSTAT_CALLS
10 DEFINES
+= -DRINGBUFFER
12 DEFINES
+= -DLIBDIR
='"$(libdir)"'
13 DEFINES
+= -DETCDIR
='"$(etcdir)"'
14 DEFINES
+= -DSTATEDIR
='"$(statedir)"'
18 OPTIM
+= -funroll-loops
19 OPTIM
+= -fomit-frame-pointer
20 OPTIM
+= -finline-functions
21 #OPTIM += -fstrength-reduce
26 CPPFLAGS
= $(INCLUDES
) $(DEFINES
)
27 CFLAGS
= -Wall
$(OPTIM
)
30 INSTALL
= install -c
-D
-o root
-g root
47 PLUGINS
= garden.so autothrottle.so autosnoop.so stripdomain.so
48 TARGETS
= l2tpns nsctl generateload bounce
$(PLUGINS
)
53 rm -f
*.o
$(TARGETS
) Makefile.tmp Makefile.bak
56 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
57 gcc
-MM
$(CPPFLAGS
) $(OBJS
:.o
=.c
) && \
58 gcc
-MM
$(CPPFLAGS
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
59 mv Makefile Makefile.bak
60 mv Makefile.tmp Makefile
63 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
) -lcli
-ldl
65 nsctl
: nsctl.o control.o
66 $(LD
) $(LDFLAGS
) -o
$@
$^
$(LDLIBS
)
68 generateload
: test/generateload.o
69 $(LD
) $(LDFLAGS
) -o
$@
$^
# -lpthread
72 $(LD
) $(LDFLAGS
) -o
$@
$^
75 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
78 $(CC
) -fPIC
-shared
$(CFLAGS
) $(CPPFLAGS
) $(LDFLAGS
) -o
$@
$<
80 # install config files only if a startup-config does not exist yet
81 # this does not interfere when building rpms or debs and makes
82 # fast upgrading via make install possible
85 $(INSTALL
) -m
0755 l2tpns
$(DESTDIR
)$(bindir)/l2tpns
86 $(INSTALL
) -m
0755 nsctl
$(DESTDIR
)$(bindir)/nsctl
87 @if
[ -f
$(DESTDIR
)$(etcdir
)/startup-config
]; then \
88 echo
'***' Installing default config files in
$(DESTDIR
)$(etcdir
) as .defaults
; \
91 echo
'***' Installing default config files in
$(DESTDIR
)$(etcdir
) - remember to adjust them
; \
94 $(INSTALL
) -m
0600 etc
/startup-config.default
$(DESTDIR
)$(etcdir
)/startup-config
$$suffix; \
95 $(INSTALL
) -m
0644 etc
/ip_pool.default
$(DESTDIR
)$(etcdir
)/ip_pool
$$suffix; \
96 $(INSTALL
) -m
0600 etc
/users.default
$(DESTDIR
)$(etcdir
)/users
$$suffix
98 for plugin in
$(PLUGINS
); do \
99 $(INSTALL
) -m
0755 $$plugin $(DESTDIR
)$(libdir)/$$plugin; \
102 if
[ -z
$(DESTDIR
) ] && [ ! -e
/dev
/net
/tun
]; then \
104 mknod
/dev
/net
/tun c
10 200; \
107 .PHONY
: all clean depend
109 ## Dependencies: (autogenerated) ##
110 arp.o
: arp.c l2tpns.h
111 bgp.o
: bgp.c l2tpns.h bgp.h util.h
112 cli.o
: cli.c l2tpns.h util.h cluster.h tbf.h ll.h bgp.h
113 cluster.o
: cluster.c l2tpns.h cluster.h util.h tbf.h bgp.h
114 constants.o
: constants.c constants.h
115 control.o
: control.c control.h
116 icmp.o
: icmp.c l2tpns.h
117 l2tpns.o
: l2tpns.c md5.h l2tpns.h cluster.h plugin.h ll.h constants.h \
118 control.h util.h tbf.h bgp.h
121 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
123 tbf.o
: tbf.c l2tpns.h util.h tbf.h
124 util.o
: util.c l2tpns.h
125 garden.so
: garden.c l2tpns.h plugin.h control.h
126 autothrottle.so
: autothrottle.c l2tpns.h plugin.h control.h
127 autosnoop.so
: autosnoop.c l2tpns.h plugin.h control.h
128 stripdomain.so
: stripdomain.c l2tpns.h plugin.h