* Update cli callbacks to work with libcli 1.6.
[l2tpns.git] / Makefile
1 PREFIX=
2 bindir = $(PREFIX)/usr/sbin
3 etcdir = $(PREFIX)/etc/l2tpns
4 libdir = $(PREFIX)/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 =
11 LIBS = -lm -ldl -lcli
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 l2tpns: $(OBJS)
35 $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(DEFS)
36
37 nsctl: nsctl.o control.o
38 $(CC) $(CFLAGS) -o $@ $^ $(DEFS)
39
40 clean:
41 /bin/rm -f *.o *.so l2tpns nsctl
42
43 depend:
44 (sed -n 'p; /^## Dependencies: (autogenerated) ##/q' Makefile && \
45 gcc -MM $(DEFINES) $(OBJS:.o=.c) && \
46 gcc -MM $(DEFINES) $(PLUGINS:.so=.c) | sed 's/\.o/.so/') >Makefile.tmp
47 mv Makefile Makefile.bak
48 mv Makefile.tmp Makefile
49
50 install: all
51 $(INSTALL) -D -o root -g root -m 0755 l2tpns $(bindir)/l2tpns
52 $(INSTALL) -D -o root -g root -m 0755 nsctl $(bindir)/nsctl
53 $(INSTALL) -D -o root -g root -m 0600 etc/l2tpns.cfg.default $(etcdir)/l2tpns.cfg
54 $(INSTALL) -D -o root -g root -m 0644 etc/ip_pool.default $(etcdir)/l2tpns.ip_pool
55 $(INSTALL) -D -o root -g root -m 0600 etc/users.default $(etcdir)/l2tpns.users
56 for PLUGIN in $(PLUGINS); do \
57 $(INSTALL) -D -o root -g root -m 0755 $(PLUGIN) $(libdir)/$(PLUGIN); \
58 done
59 if [ ! -e /dev/net/tun ]; then \
60 mkdir /dev/net; \
61 mknod /dev/net/tun c 10 200; \
62 fi
63
64 %.o: %.c
65 $(CC) -c $(CFLAGS) -o $@ $<
66
67 %.so: %.c
68 $(CC) -fPIC -shared $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBS) $(LIBPATH)
69
70 .PHONY: all clean depend
71
72 ## Dependencies: (autogenerated) ##
73 md5.o: md5.c md5.h
74 icmp.o: icmp.c l2tpns.h config.h
75 cli.o: cli.c l2tpns.h config.h util.h cluster.h tbf.h ll.h bgp.h
76 l2tpns.o: l2tpns.c md5.h l2tpns.h config.h cluster.h plugin.h ll.h \
77 constants.h control.h util.h tbf.h bgp.h
78 ppp.o: ppp.c l2tpns.h config.h constants.h plugin.h util.h tbf.h \
79 cluster.h
80 radius.o: radius.c md5.h constants.h l2tpns.h config.h plugin.h util.h
81 ll.o: ll.c ll.h
82 cluster.o: cluster.c l2tpns.h config.h cluster.h util.h tbf.h bgp.h
83 arp.o: arp.c l2tpns.h config.h
84 constants.o: constants.c constants.h
85 ll.o: ll.c ll.h
86 control.o: control.c control.h
87 util.o: util.c l2tpns.h config.h
88 tbf.o: tbf.c l2tpns.h config.h util.h tbf.h
89 bgp.o: bgp.c l2tpns.h config.h bgp.h util.h
90 garden.so: garden.c l2tpns.h config.h plugin.h control.h
91 autothrottle.so: autothrottle.c l2tpns.h config.h plugin.h control.h
92 autosnoop.so: autosnoop.c l2tpns.h config.h plugin.h control.h