1#
2# pppd makefile for Linux
3# $Id: Makefile.linux,v 1.66 2004/11/13 12:02:22 paulus Exp $
4#
5
6# Default installation locations
7DESTDIR = @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)
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
122endif
123ifneq ($(wildcard /usr/lib/libcrypt.*),)
124LIBS	+= -lcrypt
125endif
126
127ifdef NEEDDES
128ifndef USE_CRYPT
129LIBS     += -ldes $(LIBS)
130else
131CFLAGS   += -DUSE_CRYPT=1
132endif
133PPPDOBJS += pppcrypt.o
134HEADERS += pppcrypt.h
135endif
136
137# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
138ifdef USE_PAM
139CFLAGS   += -DUSE_PAM
140LIBS     += -lpam -ldl
141endif
142
143# Multi-linnk
144ifdef HAVE_MULTILINK
145	# Multilink implies the use of TDB
146	USE_TDB=y
147
148	CFLAGS += -DHAVE_MULTILINK
149	PPPDSRCS += multilink.c
150	PPPDOBJS += multilink.o
151endif
152
153# TDB
154ifdef USE_TDB
155	CFLAGS += -DUSE_TDB=1
156	PPPDSRCS += tdb.c spinlock.c
157	PPPDOBJS += tdb.o spinlock.o
158	HEADERS += tdb.h spinlock.h
159endif
160
161# Lock library binary for Linux is included in 'linux' subdirectory.
162ifdef LOCKLIB
163LIBS     += -llock
164CFLAGS   += -DLOCKLIB=1
165endif
166
167ifdef PLUGIN
168CFLAGS	+= -DPLUGIN
169LDFLAGS	+= -Wl,-E
170LIBS	+= -ldl
171endif
172
173ifdef FILTER
174ifneq ($(wildcard /usr/include/pcap-bpf.h),)
175LIBS    += -lpcap
176CFLAGS  += -DPPP_FILTER
177endif
178endif
179
180ifdef HAVE_INET6
181     PPPDSRCS += ipv6cp.c eui64.c
182     HEADERS  += ipv6cp.h eui64.h
183     PPPDOBJS += ipv6cp.o eui64.o
184     CFLAGS   += -DINET6=1
185endif
186
187ifdef CBCP
188     PPPDSRCS += cbcp.c
189     PPPDOBJS += cbcp.o
190     CFLAGS += -DCBCP_SUPPORT
191     HEADERS += cbcp.h
192endif
193
194ifdef MAXOCTETS
195     CFLAGS += -DMAXOCTETS
196endif
197
198INSTALL= install
199
200all: $(TARGETS)
201
202install: pppd
203	mkdir -p $(BINDIR) $(MANDIR)
204	$(EXTRAINSTALL)
205	$(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
206	if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
207	  chmod o-rx,u+s $(BINDIR)/pppd; fi
208	$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
209
210pppd: $(PPPDOBJS)
211	$(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
212
213srp-entry:	srp-entry.c
214	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
215
216install-devel:
217	mkdir -p $(INCDIR)/pppd
218	$(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
219
220clean:
221	rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
222
223depend:
224	$(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
225