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
$(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
)
78 $(CC
) -c
$(CFLAGS
) -o
$@
$<
81 $(CC
) -fPIC
-shared
$(CFLAGS
) -o
$@
$< $(LDFLAGS
) $(LIBS
)
83 .PHONY
: all clean depend
85 ## Dependencies: (autogenerated) ##
87 icmp.o
: icmp.c l2tpns.h config.h
88 cli.o
: cli.c l2tpns.h config.h util.h cluster.h tbf.h ll.h bgp.h
89 l2tpns.o
: l2tpns.c md5.h l2tpns.h config.h cluster.h plugin.h ll.h \
90 constants.h control.h util.h tbf.h bgp.h
91 ppp.o
: ppp.c l2tpns.h config.h constants.h plugin.h util.h tbf.h \
93 radius.o
: radius.c md5.h constants.h l2tpns.h config.h plugin.h util.h
95 cluster.o
: cluster.c l2tpns.h config.h cluster.h util.h tbf.h bgp.h
96 arp.o
: arp.c l2tpns.h config.h
97 constants.o
: constants.c constants.h
99 control.o
: control.c control.h
100 util.o
: util.c l2tpns.h config.h
101 tbf.o
: tbf.c l2tpns.h config.h util.h tbf.h
102 bgp.o
: bgp.c l2tpns.h config.h bgp.h util.h
103 garden.so
: garden.c l2tpns.h config.h plugin.h control.h
104 autothrottle.so
: autothrottle.c l2tpns.h config.h plugin.h control.h
105 autosnoop.so
: autosnoop.c l2tpns.h config.h plugin.h control.h