Set a maximum time to wait for radius to be ready on shutdown
[l2tpns.git] / Makefile
1 DESTDIR =
2 bindir = $(DESTDIR)/usr/sbin
3 etcdir = $(DESTDIR)/etc/l2tpns
4 libdir = $(DESTDIR)/usr/lib/l2tpns
5
6 CC = gcc
7 DEFINES = -DBGP -DRINGBUFFER -DSTAT_CALLS -DSTATISTICS
8 OPTIM = -g -O3 -funroll-loops -fomit-frame-pointer -finline-functions
9 CFLAGS = -Wall $(OPTIM) $(DEFINES)
10 LDFLAGS = -rdynamic
11 LIBS = -lm
12 INSTALL = /usr/bin/install -c
13
14 OBJS= md5.o \
15 icmp.o \
16 cli.o \
17 l2tpns.o \
18 ppp.o \
19 radius.o \
20 ll.o \
21 cluster.o \
22 arp.o \
23 constants.o \
24 ll.o \
25 control.o \
26 util.o \
27 tbf.o \
28 bgp.o \
29
30 PLUGINS=garden.so autothrottle.so autosnoop.so
31
32 all: l2tpns nsctl $(PLUGINS)
33
34 clean:
35 /bin/rm -f *.o *.so l2tpns nsctl
36
37 depend:
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
43
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
47
48 install: all
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; \
56 else \
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; \
61 fi
62
63 for plugin in $(PLUGINS); do \
64 $(INSTALL) -D -o root -g root -m 0755 $$plugin $(libdir)/$$plugin; \
65 done
66 if [ ! -e /dev/net/tun ]; then \
67 mkdir /dev/net; \
68 mknod /dev/net/tun c 10 200; \
69 fi
70
71 l2tpns: $(OBJS)
72 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) -lcli -ldl
73
74 nsctl: nsctl.o control.o
75 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
76
77 %.o: %.c
78 $(CC) -c $(CFLAGS) -o $@ $<
79
80 %.so: %.c
81 $(CC) -fPIC -shared $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBS)
82
83 .PHONY: all clean depend
84
85 ## Dependencies: (autogenerated) ##
86 md5.o: md5.c md5.h
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 \
92 cluster.h
93 radius.o: radius.c md5.h constants.h l2tpns.h config.h plugin.h util.h
94 ll.o: ll.c ll.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
98 ll.o: ll.c ll.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