Merge branch 'Teaman-ND' into Teaman-RT
[tomato.git] / release / src / router / xl2tpd / Makefile
blob1d26d0f34f57d42969605b0e14723032bf8ad0a7
2 # Layer Two Tunneling Protocol Daemon
3 # Copyright (C)1998 Adtran, Inc.
5 # Mark Spencer <markster@marko.net>
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.
11 # Note on debugging flags:
12 # -DDEBUG_ZLB shows all ZLB exchange traffic
13 # -DDEBUG_HELLO debugs when hello messages are sent
14 # -DDEBUG_CLOSE debugs call and tunnel closing
15 # -DDEBUG_FLOW debugs flow control system
16 # -DDEBUG_FILE debugs file format
17 # -DDEBUG_AAA debugs authentication, accounting, and access control
18 # -DDEBUG_PAYLOAD shows info on every payload packet
19 # -DDEBUG_CONTROL shows info on every control packet and the l2tp-control pipe
20 # -DDEBUG_PPPD shows the command line of pppd and how we signal pppd (see below)
21 # -DDEBUG_HIDDEN debugs hidden AVP's
22 # -DDEBUG_ENTROPY debug entropy generation
23 # -DDEBUG_CONTROL_XMIT
24 # -DDEBUG_MAGIC
25 # -DDEBUG_FLOW_MORE
26 # -DDEBUG_AUTH
28 # -DTEST_HIDDEN makes Assigned Call ID sent as a hidden AVP
30 # -DTRUST_PPPD_TO_DIE
32 # Defining TRUST_PPPD_TO_DIE disables a workaround for broken pppds. Do NOT
33 # define this unless you fully trust your version of pppd to honour SIGTERM.
34 # However, if you experience hanging pppd's, which cause xl2tpd to also hang,
35 # enable this.
36 # The cost of not trusting pppd to die (and shoot it down hard), is that your
37 # pppd's ip-down scripts will not have a chance to run.
39 # For more details see: http://bugs.xelerance.com/view.php?id=739
41 # Confirmed bad versions of pppd:
42 # - ppp-2.4.2-6.4.RHEL4
43 # Confirmed good version of pppd:
44 # - recent Ubuntu/Debian pppd's
46 # ppp 2.4.3 sends a SIGTERM after 5 seconds, so it should be safe to
47 # trust pppd. This work around will be removed in the near future.
49 # DFLAGS= -g -DDEBUG_HELLO -DDEBUG_CLOSE -DDEBUG_FLOW -DDEBUG_PAYLOAD -DDEBUG_CONTROL -DDEBUG_CONTROL_XMIT -DDEBUG_FLOW_MORE -DDEBUG_MAGIC -DDEBUG_ENTROPY -DDEBUG_HIDDEN -DDEBUG_PPPD -DDEBUG_AAA -DDEBUG_FILE -DDEBUG_FLOW -DDEBUG_HELLO -DDEBUG_CLOSE -DDEBUG_ZLB -DDEBUG_AUTH
50 DFLAGS?= -DTRUST_PPPD_TO_DIE
52 # Uncomment the next line for Linux. KERNELSRC is needed for if_pppol2tp.h,
53 # but we use a local copy if we don't find it.
55 #KERNELSRC=/lib/modules/`uname -r`/build/
56 KERNELSRC?=./linux
57 OSFLAGS?= -DLINUX -I$(KERNELSRC)/include/
59 # Uncomment the following to use the kernel interface under Linux
60 # This requires the pppol2tp-linux-2.4.27.patch patch from contrib
61 # or a 2.6.23+ kernel. On some distributions kernel include files
62 # are packages seperately (eg kernel-headers on Fedora)
63 # Note: 2.6.23+ support still needs some changes in the xl2tpd source
65 OSFLAGS+= -DUSE_KERNEL
68 # Uncomment the next line for FreeBSD
70 #OSFLAGS?= -DFREEBSD
72 # Uncomment the next line for Solaris. For solaris, at least,
73 # we don't want to specify -I/usr/include because it is in
74 # the basic search path, and will over-ride some gcc-specific
75 # include paths and cause problems.
77 #CC?=gcc
78 #OSFLAGS?= -DSOLARIS
79 #OSLIBS?= -lnsl -lsocket
81 # Uncomment the next two lines for OpenBSD
83 #OSFLAGS?= -DOPENBSD
84 #LDLIBS?= -lutil
86 # Feature flags
88 # Comment the following line to disable xl2tpd maintaining IP address
89 # pools to pass to pppd to control IP address allocation
91 IPFLAGS?= -DIP_ALLOCATION
93 CFLAGS+= $(DFLAGS) -O2 -fno-builtin -Wall -DSANITY $(OSFLAGS) $(IPFLAGS)
94 HDRS=l2tp.h avp.h misc.h control.h call.h scheduler.h file.h aaa.h md5.h
95 OBJS=xl2tpd.o pty.o misc.o control.o avp.o call.o network.o avpsend.o scheduler.o file.o aaa.o md5.o
96 SRCS=${OBJS:.o=.c} ${HDRS}
97 CONTROL_SRCS=xl2tpd-control.c
98 #LIBS= $(OSLIBS) # -lefence # efence for malloc checking
99 EXEC=xl2tpd
100 CONTROL_EXEC=xl2tpd-control
102 PREFIX?=/usr/local
103 SBINDIR?=$(DESTDIR)${PREFIX}/sbin
104 BINDIR?=$(DESTDIR)${PREFIX}/bin
105 MANDIR?=$(DESTDIR)${PREFIX}/share/man
108 all: $(EXEC) pfc $(CONTROL_EXEC)
110 clean:
111 rm -f $(OBJS) $(EXEC) pfc.o pfc $(CONTROL_EXEC)
113 $(EXEC): $(OBJS) $(HDRS)
114 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
116 $(CONTROL_EXEC): $(CONTROL_SRCS)
117 $(CC) $(CONTROL_SRCS) -o $@
119 pfc:
120 $(CC) $(CFLAGS) -c contrib/pfc.c
121 $(CC) $(LDFLAGS) -o pfc pfc.o -lpcap $(LDLIBS)
123 romfs:
124 $(ROMFSINST) /bin/$(EXEC)
126 install: ${EXEC} pfc ${CONTROL_EXEC}
127 install -d -m 0755 ${SBINDIR}
128 install -m 0755 $(EXEC) ${SBINDIR}/$(EXEC)
129 install -d -m 0755 ${MANDIR}/man5
130 install -d -m 0755 ${MANDIR}/man8
131 install -m 0644 doc/xl2tpd.8 ${MANDIR}/man8/
132 install -m 0644 doc/xl2tpd.conf.5 doc/l2tp-secrets.5 \
133 ${MANDIR}/man5/
134 # pfc
135 install -d -m 0755 ${BINDIR}
136 install -m 0755 pfc ${BINDIR}/pfc
137 install -d -m 0755 ${MANDIR}/man1
138 install -m 0644 contrib/pfc.1 ${MANDIR}/man1/
139 # control exec
140 install -d -m 0755 ${SBINDIR}
141 install -m 0755 $(CONTROL_EXEC) ${SBINDIR}/$(CONTROL_EXEC)
143 # openbsd
144 # install -d -m 0755 /var/run/xl2tpd
145 # mkfifo /var/run/l2tp-control
148 TAGS: ${SRCS}
149 etags ${SRCS}