1#
2# pppd makefile for Linux
3# $Id: Makefile.linux,v 1.69 2006/06/04 05:07:46 paulus 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
17
18HEADERS = ccp.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
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# Don't use MSLANMAN unless you really know what you're doing.
43#MSLANMAN=y
44# Uncomment the next line to include support for MPPE.  CHAPMS (above) must
45# also be enabled.  Also, edit plugins/radius/Makefile.linux.
46MPPE=y
47
48# Uncomment the next line to include support for PPP packet filtering.
49# This requires that the libpcap library and headers be installed
50# and that the kernel driver support PPP packet filtering.
51FILTER=y
52
53# Uncomment the next line to enable multilink PPP (enabled by default)
54# Linux distributions: Please leave multilink ENABLED in your builds
55# of pppd!
56HAVE_MULTILINK=y
57
58# Uncomment the next line to enable the TDB database (enabled by default.)
59# If you enable multilink, then TDB is automatically enabled also.
60# Linux distributions: Please leave TDB ENABLED in your builds.
61USE_TDB=y
62
63HAS_SHADOW=y
64#USE_PAM=y
65#HAVE_INET6=y
66
67# Enable plugins
68PLUGIN=y
69
70# Enable Microsoft proprietary Callback Control Protocol
71#CBCP=y
72
73# Enable EAP SRP-SHA1 authentication (requires libsrp)
74#USE_SRP=y
75
76MAXOCTETS=y
77
78INCLUDE_DIRS= -I../include
79
80COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
81
82CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
83
84ifdef CHAPMS
85CFLAGS   += -DCHAPMS=1
86NEEDDES=y
87PPPDOBJS += md4.o chap_ms.o
88HEADERS	+= md4.h chap_ms.h
89ifdef MSLANMAN
90CFLAGS   += -DMSLANMAN=1
91endif
92ifdef MPPE
93CFLAGS   += -DMPPE=1
94endif
95endif
96
97# EAP SRP-SHA1
98ifdef USE_SRP
99CFLAGS	+= -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
100LIBS	+= -lsrp -L/usr/local/ssl/lib -lcrypto
101TARGETS	+= srp-entry
102EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
103MANPAGES += srp-entry.8
104EXTRACLEAN += srp-entry.o
105NEEDDES=y
106else
107# OpenSSL has an integrated version of SHA-1, and its implementation
108# is incompatible with this local SHA-1 implementation.  We must use
109# one or the other, not both.
110PPPDSRCS += sha1.c
111HEADERS += sha1.h
112PPPDOBJS += sha1.o
113endif
114
115ifdef HAS_SHADOW
116CFLAGS   += -DHAS_SHADOW
117#LIBS     += -lshadow $(LIBS)
118endif
119
120ifneq ($(wildcard /usr/include/crypt.h),)
121CFLAGS  += -DHAVE_CRYPT_H=1
122LIBS	+= -lcrypt
123endif
124
125ifdef NEEDDES
126ifndef USE_CRYPT
127LIBS     += -ldes $(LIBS)
128else
129CFLAGS   += -DUSE_CRYPT=1
130endif
131PPPDOBJS += pppcrypt.o
132HEADERS += pppcrypt.h
133endif
134
135# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
136ifdef USE_PAM
137CFLAGS   += -DUSE_PAM
138LIBS     += -lpam -ldl
139endif
140
141# Multi-linnk
142ifdef HAVE_MULTILINK
143	# Multilink implies the use of TDB
144	USE_TDB=y
145
146	CFLAGS += -DHAVE_MULTILINK
147	PPPDSRCS += multilink.c
148	PPPDOBJS += multilink.o
149endif
150
151# TDB
152ifdef USE_TDB
153	CFLAGS += -DUSE_TDB=1
154	PPPDSRCS += tdb.c spinlock.c
155	PPPDOBJS += tdb.o spinlock.o
156	HEADERS += tdb.h spinlock.h
157endif
158
159# Lock library binary for Linux is included in 'linux' subdirectory.
160ifdef LOCKLIB
161LIBS     += -llock
162CFLAGS   += -DLOCKLIB=1
163endif
164
165ifdef PLUGIN
166CFLAGS	+= -DPLUGIN
167LDFLAGS	+= -Wl,-E
168LIBS	+= -ldl
169endif
170
171ifdef FILTER
172ifneq ($(wildcard /usr/include/pcap-bpf.h),)
173LIBS    += -lpcap
174CFLAGS  += -DPPP_FILTER
175endif
176endif
177
178ifdef HAVE_INET6
179     PPPDSRCS += ipv6cp.c eui64.c
180     HEADERS  += ipv6cp.h eui64.h
181     PPPDOBJS += ipv6cp.o eui64.o
182     CFLAGS   += -DINET6=1
183endif
184
185ifdef CBCP
186     PPPDSRCS += cbcp.c
187     PPPDOBJS += cbcp.o
188     CFLAGS += -DCBCP_SUPPORT
189     HEADERS += cbcp.h
190endif
191
192ifdef MAXOCTETS
193     CFLAGS += -DMAXOCTETS
194endif
195
196INSTALL= install
197
198all: $(TARGETS)
199
200install: pppd
201	mkdir -p $(BINDIR) $(MANDIR)
202	$(EXTRAINSTALL)
203	$(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
204	if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
205	  chmod o-rx,u+s $(BINDIR)/pppd; fi
206	$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
207
208pppd: $(PPPDOBJS)
209	$(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
210
211srp-entry:	srp-entry.c
212	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
213
214install-devel:
215	mkdir -p $(INCDIR)/pppd
216	$(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
217
218clean:
219	rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
220
221depend:
222	$(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
223