-OBJS = arp.o \
- bgp.o \
- cli.o \
- cluster.o \
- constants.o \
- control.o \
- icmp.o \
- l2tpns.o \
- ll.o \
- md5.o \
- ppp.o \
- radius.o \
- tbf.o \
- util.o
-
-PLUGINS = garden.so autothrottle.so autosnoop.so stripdomain.so setrxspeed.so
-TARGETS = l2tpns nsctl generateload bounce $(PLUGINS)
-
-all: $(TARGETS)
+l2tpns.LIBS = -lm -lcli -ldl
+
+OBJS = arp.o cli.o cluster.o constants.o control.o icmp.o l2tpns.o \
+ ll.o md5.o ppp.o radius.o tbf.o util.o pppoe.o
+
+PROGRAMS = l2tpns nsctl
+PLUGINS = autosnoop.so autothrottle.so garden.so sessionctl.so \
+ setrxspeed.so snoopctl.so stripdomain.so throttlectl.so
+
+DEFINES += -DSTATISTICS
+DEFINES += -DSTAT_CALLS
+DEFINES += -DRINGBUFFER
+
+ifneq (2.4, $(shell uname -r | perl -pe 's/^(\d+\.\d+).*/$$1/'))
+ DEFINES += -DHAVE_EPOLL
+endif
+
+DEFINES += -DBGP
+OBJS += bgp.o
+
+DEFINES += -DLAC
+OBJS += l2tplac.o
+
+all: programs plugins
+programs: $(PROGRAMS)
+plugins: $(PLUGINS)