1#
2# Layer Two Tunneling Protocol Daemon
3# Copyright (C)1998 Adtran, Inc.
4#
5# Mark Spencer <markster@marko.net>
6#
7# This is free software.  You may distribute it under
8# the terms of the GNU General Public License,
9# version 2, or at your option any later version.
10#
11# Note on debugging flags:
12# -DDEBUG_ZLB shows all ZLB exchange traffic
13# -DDEBUG_CONTROL debugs the /var/run/l2tp-control pipe interface
14# -DDEBUG_HELLO debugs when hello messages are sent
15# -DDEBUG_CLOSE debugs call and tunnel closing
16# -DDEBUG_FLOW debugs flow control system
17# -DDEBUG_FILE debugs file format
18# -DDEBUG_AAA debugs authentication, accounting, and access control
19# -DDEBUG_PAYLOAD shows info on every payload packet
20# -DDEBUG_CONTROL shows info on every control packet
21# -DDEBUG_PPPD shows the command line of pppd
22# -DDEBUG_HIDDEN debugs hidden AVP's
23# -DDEBUG_ENTROPY debug entropy generation
24# -DTEST_HIDDEN makes Assigned Call ID sent as a hidden AVP
25#
26# Also look at the top of network.c for some other (eventually to 
27# become runtime options) debugging flags
28#
29include ../config.in
30include ../config.mk
31
32#CC= /opt/brcm/hndtools-mipsel-uclibc-3.2.3/bin/mipsel-uclibc-gcc
33#DFLAGS= -g -O2 -DDEBUG_PPPD
34DFLAGS= -g -O2 -DDEBUG_PPPD -DDEBUG_CONTROL -DDEBUG_ENTROPY -DDEBUG_CLOSE -DPPPOX_L2TP
35#
36# Uncomment the next line for Linux
37#
38#OSFLAGS= -DLINUX -I/usr/include
39#Foxconn add start by Hank 07/30/2012
40#For Kernel 2.6.36
41ifeq ($(CONFIG_KERNEL_2_6_36),y)
42OSFLAGS= -DLINUX -I$(TOOLCHAIN)/include/ -DUSE_KERNEL
43else
44OSFLAGS= -DLINUX -I/opt/brcm/hndtools-mipsel-uclibc-3.2.3/include/
45endif
46
47
48OSFLAGS+= -I$(LINUXDIR)/include/
49
50#
51# Uncomment the following to use the kernel interface under Linux
52#
53#OSFLAGS+= -DUSE_KERNEL
54#
55# Uncomment the next line for FreeBSD
56#
57#OSFLAGS= -DFREEBSD
58#
59# Uncomment the next line for Solaris. For solaris, at least,
60# we don't want to specify -I/usr/include because it is in
61# the basic search path, and will over-ride some gcc-specific
62# include paths and cause problems.
63#
64#OSFLAGS= -DSOLARIS
65#OSLIBS= -lnsl -lsocket
66#
67# Feature flags
68#
69# Comment the following line to disable l2tpd maintaining IP address
70# pools to pass to pppd to control IP address allocation
71
72FFLAGS= -DIP_ALLOCATION 
73
74CFLAGS= $(DFLAGS) -Wall -DSANITY $(OSFLAGS) $(FFLAGS)
75
76#add static_pppoe define.
77ifeq ($(CONFIG_STATIC_PPPOE),y)
78CFLAGS  += -DSTATIC_PPPOE
79else
80CFLAGS  += -USTATIC_PPPOE
81endif
82
83HDRS=l2tp.h avp.h misc.h control.h call.h scheduler.h file.h aaa.h md5.h
84OBJS=l2tpd.o pty.o misc.o control.o avp.o call.o network.o avpsend.o scheduler.o file.o aaa.o md5.o
85LIBS= $(OSLIB) # -lefence # efence for malloc checking
86BIN=l2tpd
87BINDIR=$(TARGETDIR)/usr/sbin
88ETCDIR=$(TARGETDIR)/etc
89
90all: $(BIN)
91
92clean:
93	rm -f $(OBJS) $(BIN)
94
95$(BIN): $(OBJS) $(HDRS)
96	$(CC) -o $(BIN) $(DFLAGS) $(OBJS) $(LIBS)
97
98install:
99	mkdir -p $(BINDIR)
100	install -m 755 l2tpd $(BINDIR)
101	$(STRIP) $(BINDIR)/l2tpd
102	rm -f $(BINDIR)/st*
103