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