1#
2# pppd makefile for Linux
3# $Id: Makefile.linux,v 1.70 2007/06/19 02:08:34 carlsonj Exp $
4#
5
6# Default installation locations
7DESTDIR = $(INSTROOT)@DESTDIR@
8BINDIR = $(DESTDIR)/sbin
9MANDIR = $(DESTDIR)/share/man/man8
10INCDIR = $(DESTDIR)/include
11
12TARGETS = pppd
13
14PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap-new.c md5.c ccp.c \
15	   ecp.c ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c \
16	   demand.c utils.c tty.c eap.c chap-md5.c session.c
17
18HEADERS = ccp.h session.h chap-new.h ecp.h fsm.h ipcp.h \
19	ipxcp.h lcp.h magic.h md5.h patchlevel.h pathnames.h pppd.h \
20	upap.h eap.h
21
22MANPAGES = pppd.8
23PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o md5.o ccp.o \
24	   ecp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o tty.o \
25	   eap.o chap-md5.o session.o
26
27#
28# include dependencies if present
29ifeq (.depend,$(wildcard .depend))
30include .depend
31endif
32
33# CC = gcc
34#
35COPTS = -O2 -pipe -Wall -g
36LIBS =
37
38# Uncomment the next 2 lines to include support for Microsoft's
39# MS-CHAP authentication protocol.  Also, edit plugins/radius/Makefile.linux.
40CHAPMS=y
41USE_CRYPT=y
42# Alternatively, if you want to use OpenSSL for DES functions, comment out
43# USE_CRYPT, above, and uncomment this line.
44#USE_OPENSSL=y
45# Don't use MSLANMAN unless you really know what you're doing.
46#MSLANMAN=y
47# Uncomment the next line to include support for MPPE.  CHAPMS (above) must
48# also be enabled.  Also, edit plugins/radius/Makefile.linux.
49MPPE=y
50
51# Uncomment the next line to include support for PPP packet filtering.
52# This requires that the libpcap library and headers be installed
53# and that the kernel driver support PPP packet filtering.
54FILTER=y
55
56# Uncomment the next line to enable multilink PPP (enabled by default)
57# Linux distributions: Please leave multilink ENABLED in your builds
58# of pppd!
59HAVE_MULTILINK=y
60
61# Uncomment the next line to enable the TDB database (enabled by default.)
62# If you enable multilink, then TDB is automatically enabled also.
63# Linux distributions: Please leave TDB ENABLED in your builds.
64USE_TDB=y
65
66HAS_SHADOW=y
67#USE_PAM=y
68HAVE_INET6=y
69
70# Enable plugins
71PLUGIN=y
72
73# Enable Microsoft proprietary Callback Control Protocol
74#CBCP=y
75
76# Enable EAP SRP-SHA1 authentication (requires libsrp)
77#USE_SRP=y
78
79# Use libutil
80USE_LIBUTIL=y
81
82MAXOCTETS=y
83
84INCLUDE_DIRS= -I../include
85
86COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
87
88CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
89
90ifdef CHAPMS
91CFLAGS   += -DCHAPMS=1
92NEEDDES=y
93PPPDOBJS += md4.o chap_ms.o
94HEADERS	+= md4.h chap_ms.h
95ifdef MSLANMAN
96CFLAGS   += -DMSLANMAN=1
97endif
98ifdef MPPE
99CFLAGS   += -DMPPE=1
100endif
101endif
102
103# EAP SRP-SHA1
104ifdef USE_SRP
105CFLAGS	+= -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
106LIBS	+= -lsrp -L/usr/local/ssl/lib -lcrypto
107TARGETS	+= srp-entry
108EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
109MANPAGES += srp-entry.8
110EXTRACLEAN += srp-entry.o
111NEEDDES=y
112else
113# OpenSSL has an integrated version of SHA-1, and its implementation
114# is incompatible with this local SHA-1 implementation.  We must use
115# one or the other, not both.
116PPPDSRCS += sha1.c
117HEADERS += sha1.h
118PPPDOBJS += sha1.o
119endif
120
121ifdef HAS_SHADOW
122CFLAGS   += -DHAS_SHADOW
123#LIBS     += -lshadow $(LIBS)
124endif
125
126ifneq ($(wildcard /usr/include/crypt.h),)
127CFLAGS  += -DHAVE_CRYPT_H=1
128LIBS   += -lcrypt
129endif
130
131ifdef USE_LIBUTIL
132CFLAGS	+= -DHAVE_LOGWTMP=1
133LIBS	+= -lutil
134endif
135
136ifdef NEEDDES
137ifdef USE_OPENSSL
138CFLAGS   += -DUSE_OPENSSL=1
139LIBS     += -lcrypto
140else
141ifndef USE_CRYPT
142CFLAGS   += -DUSE_LIBDES=1
143LIBS     += -ldes
144else
145CFLAGS   += -DUSE_CRYPT=1
146LIBS     += -lcrypt
147endif
148endif
149PPPDOBJS += pppcrypt.o
150HEADERS += pppcrypt.h
151endif
152
153# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
154ifdef USE_PAM
155CFLAGS   += -DUSE_PAM
156LIBS     += -lpam -ldl
157endif
158
159# Multi-linnk
160ifdef HAVE_MULTILINK
161	# Multilink implies the use of TDB
162	USE_TDB=y
163
164	CFLAGS += -DHAVE_MULTILINK
165	PPPDSRCS += multilink.c
166	PPPDOBJS += multilink.o
167endif
168
169# TDB
170ifdef USE_TDB
171	CFLAGS += -DUSE_TDB=1
172	PPPDSRCS += tdb.c spinlock.c
173	PPPDOBJS += tdb.o spinlock.o
174	HEADERS += tdb.h spinlock.h
175endif
176
177# Lock library binary for Linux is included in 'linux' subdirectory.
178ifdef LOCKLIB
179LIBS     += -llock
180CFLAGS   += -DLOCKLIB=1
181endif
182
183ifdef PLUGIN
184CFLAGS	+= -DPLUGIN
185LDFLAGS	+= -Wl,-E
186LIBS	+= -ldl
187endif
188
189ifdef FILTER
190ifneq ($(wildcard /usr/include/pcap-bpf.h),)
191LIBS    += -lpcap
192CFLAGS  += -DPPP_FILTER
193endif
194endif
195
196ifdef HAVE_INET6
197     PPPDSRCS += ipv6cp.c eui64.c
198     HEADERS  += ipv6cp.h eui64.h
199     PPPDOBJS += ipv6cp.o eui64.o
200     CFLAGS   += -DINET6=1
201endif
202
203ifdef CBCP
204     PPPDSRCS += cbcp.c
205     PPPDOBJS += cbcp.o
206     CFLAGS += -DCBCP_SUPPORT
207     HEADERS += cbcp.h
208endif
209
210ifdef MAXOCTETS
211     CFLAGS += -DMAXOCTETS
212endif
213
214INSTALL= install
215
216all: $(TARGETS)
217
218install: pppd
219	mkdir -p $(BINDIR) $(MANDIR)
220	$(EXTRAINSTALL)
221	$(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
222	if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
223	  chmod o-rx,u+s $(BINDIR)/pppd; fi
224	$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
225
226pppd: $(PPPDOBJS)
227	$(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
228
229srp-entry:	srp-entry.c
230	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
231
232install-devel:
233	mkdir -p $(INCDIR)/pppd
234	$(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
235
236clean:
237	rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
238
239depend:
240	$(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
241