a7f36313264e1f544591be8a8648e66df05eb3a6
[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 CFLAGS=-Wall -g -O2
8 LDFLAGS =
9 LIBS = -lm -ldl -lcli
10 INSTALL = /usr/bin/install -c
11
12 OBJS= md5.o \
13 icmp.o \
14 cli.o \
15 l2tpns.o \
16 ppp.o \
17 radius.o \
18 throttle.o \
19 rl.o \
20 ll.o \
21 cluster.o \
22 cluster_slave.o \
23 arp.o \
24 constants.o \
25 ll.o \
26 control.o \
27 util.o \
28
29 PLUGINS=garden.so autothrottle.so autosnoop.so
30
31 all: l2tpns cluster_master nsctl $(PLUGINS)
32
33 l2tpns: $(OBJS)
34 $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(DEFS)
35
36 cluster_master: cluster_master.o ll.o cluster.o util.o
37 $(CC) $(CFLAGS) -o $@ $^ $(DEFS)
38
39 nsctl: nsctl.o control.o
40 $(CC) $(CFLAGS) -o $@ $^ $(DEFS)
41
42 clean:
43 /bin/rm -f *.o *.so l2tpns cluster_master nsctl
44
45 install: all
46 $(INSTALL) -D -o root -g root -m 0755 l2tpns $(bindir)/l2tpns
47 $(INSTALL) -D -o root -g root -m 0755 cluster_master $(bindir)/cluster_master
48 $(INSTALL) -D -o root -g root -m 0755 nsctl $(bindir)/nsctl
49 $(INSTALL) -D -o root -g root -m 0600 etc/l2tpns.cfg.default $(etcdir)/l2tpns.cfg
50 $(INSTALL) -D -o root -g root -m 0644 etc/ip_pool.default $(etcdir)/l2tpns.ip_pool
51 $(INSTALL) -D -o root -g root -m 0600 etc/users.default $(etcdir)/l2tpns.users
52 for PLUGIN in $(PLUGINS); do \
53 $(INSTALL) -o root -g root -m 0755 $(PLUGIN) $(libdir)/$(PLUGIN); \
54 done
55 if [ ! -e /dev/net/tun ]; then \
56 mkdir /dev/net; \
57 mknod /dev/net/tun c 10 200; \
58 fi
59
60 %.so: %.c
61 $(CC) -fPIC -shared -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBPATH)
62