2 bindir = $(DESTDIR
)/usr
/sbin
3 etcdir
= $(DESTDIR
)/etc
/l2tpns
4 libdir = $(DESTDIR
)/usr
/lib
/l2tpns
7 DEFINES
= -DBGP
-DRINGBUFFER
-DSTAT_CALLS
-DSTATISTICS
8 OPTIM
= -g
-O3
-funroll-loops
-fomit-frame-pointer
-finline-functions
9 CFLAGS
= -Wall
$(OPTIM
) $(DEFINES
)
12 INSTALL
= /usr
/bin
/install -c
30 PLUGINS
=garden.so autothrottle.so autosnoop.so
32 all: l2tpns nsctl generateload bounce
$(PLUGINS
)
35 /bin
/rm -f
*.o
*.so l2tpns nsctl
38 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
39 gcc
-MM
$(DEFINES
) $(OBJS
:.o
=.c
) && \
40 gcc
-MM
$(DEFINES
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
41 mv Makefile Makefile.bak
42 mv Makefile.tmp Makefile
44 # install config files only if a startup-config does not exist yet JK 20040713
45 # this does not interfere when building rpms or debs and makes
46 # fast upgrading via make install possible
49 $(INSTALL
) -D
-o root
-g root
-m
0755 l2tpns
$(bindir)/l2tpns
50 $(INSTALL
) -D
-o root
-g root
-m
0755 nsctl
$(bindir)/nsctl
51 @if
[ -f
$(etcdir
)/startup-config
]; then \
52 echo
'***' Installing default config files in
$(etcdir
) as .defaults
; \
53 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/startup-config.default
$(etcdir
)/startup-config.default
; \
54 $(INSTALL
) -D
-o root
-g root
-m
0644 etc
/ip_pool.default
$(etcdir
)/ip_pool.default
; \
55 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/users.default
$(etcdir
)/users.default
; \
57 echo
'***' Installing default config files in
$(etcdir
) - remember to adjust them
; \
58 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/startup-config.default
$(etcdir
)/startup-config
; \
59 $(INSTALL
) -D
-o root
-g root
-m
0644 etc
/ip_pool.default
$(etcdir
)/l2tpns.ip_pool
; \
60 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/users.default
$(etcdir
)/l2tpns.users
; \
63 for plugin in
$(PLUGINS
); do \
64 $(INSTALL
) -D
-o root
-g root
-m
0755 $$plugin $(libdir)/$$plugin; \
66 if
[ ! -e
/dev
/net
/tun
]; then \
68 mknod
/dev
/net
/tun c
10 200; \
72 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
) -lcli
-ldl
74 nsctl
: nsctl.o control.o
75 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
)
77 generateload
: test/generateload.o
78 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
)
81 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
)
84 $(CC
) -c
$(CFLAGS
) -o
$@
$<
87 $(CC
) -fPIC
-shared
$(CFLAGS
) -o
$@
$< $(LDFLAGS
) $(LIBS
)
89 .PHONY
: all clean depend
91 ## Dependencies: (autogenerated) ##
93 icmp.o
: icmp.c l2tpns.h config.h
94 cli.o
: cli.c l2tpns.h config.h util.h cluster.h tbf.h ll.h bgp.h
95 l2tpns.o
: l2tpns.c md5.h l2tpns.h config.h cluster.h plugin.h ll.h \
96 constants.h control.h util.h tbf.h bgp.h
97 ppp.o
: ppp.c l2tpns.h config.h constants.h plugin.h util.h tbf.h \
99 radius.o
: radius.c md5.h constants.h l2tpns.h config.h plugin.h util.h
101 cluster.o
: cluster.c l2tpns.h config.h cluster.h util.h tbf.h bgp.h
102 arp.o
: arp.c l2tpns.h config.h
103 constants.o
: constants.c constants.h
105 control.o
: control.c control.h
106 util.o
: util.c l2tpns.h config.h
107 tbf.o
: tbf.c l2tpns.h config.h util.h tbf.h
108 bgp.o
: bgp.c l2tpns.h config.h bgp.h util.h
109 garden.so
: garden.c l2tpns.h config.h plugin.h control.h
110 autothrottle.so
: autothrottle.c l2tpns.h config.h plugin.h control.h
111 autosnoop.so
: autosnoop.c l2tpns.h config.h plugin.h control.h