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