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 stripdomain.so
31 TARGETS
=l2tpns nsctl generateload bounce
$(PLUGINS
)
36 /bin
/rm -f
*.o
*.so
$(TARGETS
)
39 (sed
-n
'p; /^## Dependencies: (autogenerated) ##/q' Makefile
&& \
40 gcc
-MM
$(DEFINES
) $(OBJS
:.o
=.c
) && \
41 gcc
-MM
$(DEFINES
) $(PLUGINS
:.so
=.c
) | sed
's/\.o/.so/') >Makefile.tmp
42 mv Makefile Makefile.bak
43 mv Makefile.tmp Makefile
45 # install config files only if a startup-config does not exist yet JK 20040713
46 # this does not interfere when building rpms or debs and makes
47 # fast upgrading via make install possible
50 $(INSTALL
) -D
-o root
-g root
-m
0755 l2tpns
$(bindir)/l2tpns
51 $(INSTALL
) -D
-o root
-g root
-m
0755 nsctl
$(bindir)/nsctl
52 @if
[ -f
$(etcdir
)/startup-config
]; then \
53 echo
'***' Installing default config files in
$(etcdir
) as .defaults
; \
54 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/startup-config.default
$(etcdir
)/startup-config.default
; \
55 $(INSTALL
) -D
-o root
-g root
-m
0644 etc
/ip_pool.default
$(etcdir
)/ip_pool.default
; \
56 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/users.default
$(etcdir
)/users.default
; \
58 echo
'***' Installing default config files in
$(etcdir
) - remember to adjust them
; \
59 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/startup-config.default
$(etcdir
)/startup-config
; \
60 $(INSTALL
) -D
-o root
-g root
-m
0644 etc
/ip_pool.default
$(etcdir
)/ip_pool
; \
61 $(INSTALL
) -D
-o root
-g root
-m
0600 etc
/users.default
$(etcdir
)/users
; \
64 for plugin in
$(PLUGINS
); do \
65 $(INSTALL
) -D
-o root
-g root
-m
0755 $$plugin $(libdir)/$$plugin; \
67 if
[ ! -e
/dev
/net
/tun
]; then \
69 mknod
/dev
/net
/tun c
10 200; \
73 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
) -lcli
-ldl
75 nsctl
: nsctl.o control.o
76 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
)
78 generateload
: test/generateload.o
79 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
)
82 $(CC
) $(CFLAGS
) -o
$@
$^
$(LDFLAGS
) $(LIBS
)
85 $(CC
) -c
$(CFLAGS
) -o
$@
$<
88 $(CC
) -fPIC
-shared
$(CFLAGS
) -o
$@
$< $(LDFLAGS
) $(LIBS
)
90 .PHONY
: all clean depend
92 ## Dependencies: (autogenerated) ##
94 icmp.o
: icmp.c l2tpns.h config.h
95 cli.o
: cli.c l2tpns.h config.h util.h cluster.h tbf.h ll.h bgp.h
96 l2tpns.o
: l2tpns.c md5.h l2tpns.h config.h cluster.h plugin.h ll.h \
97 constants.h control.h util.h tbf.h bgp.h
98 ppp.o
: ppp.c l2tpns.h config.h constants.h plugin.h util.h tbf.h \
100 radius.o
: radius.c md5.h constants.h l2tpns.h config.h plugin.h util.h
102 cluster.o
: cluster.c l2tpns.h config.h cluster.h util.h tbf.h bgp.h
103 arp.o
: arp.c l2tpns.h config.h
104 constants.o
: constants.c constants.h
106 control.o
: control.c control.h
107 util.o
: util.c l2tpns.h config.h
108 tbf.o
: tbf.c l2tpns.h config.h util.h tbf.h
109 bgp.o
: bgp.c l2tpns.h config.h bgp.h util.h
110 garden.so
: garden.c l2tpns.h config.h plugin.h control.h
111 autothrottle.so
: autothrottle.c l2tpns.h config.h plugin.h control.h
112 autosnoop.so
: autosnoop.c l2tpns.h config.h plugin.h control.h