]> git.ozlabs.org Git - ppp.git/blob - pppd/Makefile.linux
Add pkgconfig support to PPP project (#270)
[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 HEADERS  += mppe.h
113 endif
114 endif
115
116 # EAP SRP-SHA1
117 ifdef USE_SRP
118 CFLAGS  += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
119 LIBS    += -lsrp -L/usr/local/ssl/lib
120 NEEDCRYPTOLIB = y
121 TARGETS += srp-entry
122 EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
123 MANPAGES += srp-entry.8
124 EXTRACLEAN += srp-entry.o
125 NEEDDES=y
126 else
127 # OpenSSL has an integrated version of SHA-1, and its implementation
128 # is incompatible with this local SHA-1 implementation.  We must use
129 # one or the other, not both.
130 PPPDSRCS += sha1.c
131 HEADERS += sha1.h
132 PPPDOBJS += sha1.o
133 endif
134
135 # EAP-TLS
136 ifdef USE_EAPTLS
137 CFLAGS += -DUSE_EAPTLS=1
138 LIBS += -lssl
139 NEEDCRYPTOLIB = y
140 PPPDSRC += eap-tls.c
141 HEADERS += eap-tls.h
142 PPPDOBJS += eap-tls.o
143 endif
144
145 ifdef HAS_SHADOW
146 CFLAGS   += -DHAS_SHADOW
147 #LIBS     += -lshadow $(LIBS)
148 endif
149
150 CRYPTHEADER = "\#include <crypt.h>"
151 ifeq ($(shell echo $(CRYPTHEADER) | $(CC) -E - >/dev/null 2>&1 && echo yes),yes)
152 CFLAGS  += -DHAVE_CRYPT_H=1
153 LIBS    += -lcrypt
154 endif
155
156 ifdef USE_LIBUTIL
157 CFLAGS  += -DHAVE_LOGWTMP=1
158 LIBS    += -lutil
159 endif
160
161 ifdef NEEDDES
162 ifndef USE_CRYPT
163 NEEDCRYPTOLIB = y
164 else
165 CFLAGS   += -DUSE_CRYPT=1
166 endif
167 PPPDOBJS += pppcrypt.o
168 HEADERS += pppcrypt.h
169 endif
170
171 ifdef NEEDCRYPTOLIB
172 LIBS     += -lcrypto
173 endif
174
175 # For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
176 ifdef USE_PAM
177 CFLAGS   += -DUSE_PAM
178 LIBS     += -lpam -ldl
179 endif
180
181 # Multi-linnk
182 ifdef HAVE_MULTILINK
183         # Multilink implies the use of TDB
184         USE_TDB=y
185
186         CFLAGS += -DHAVE_MULTILINK
187         PPPDSRCS += multilink.c
188         PPPDOBJS += multilink.o
189 endif
190
191 # TDB
192 ifdef USE_TDB
193         CFLAGS += -DUSE_TDB=1
194         PPPDSRCS += tdb.c spinlock.c
195         PPPDOBJS += tdb.o spinlock.o
196         HEADERS += tdb.h spinlock.h
197 endif
198
199 # Lock library binary for Linux is included in 'linux' subdirectory.
200 ifdef LOCKLIB
201 LIBS     += -llock
202 CFLAGS   += -DLOCKLIB=1
203 endif
204
205 ifdef SYSTEMD
206 LIBS += -lsystemd
207 CFLAGS   += -DSYSTEMD=1
208 endif
209
210 ifdef PLUGIN
211 CFLAGS  += -DPLUGIN
212 LDFLAGS_PLUGIN  += -Wl,-E
213 LIBS    += -ldl
214 endif
215
216 ifdef FILTER
217 LIBS    += -lpcap
218 CFLAGS  += -DPPP_FILTER
219 endif
220
221 ifdef HAVE_INET6
222      PPPDSRCS += ipv6cp.c eui64.c
223      HEADERS  += ipv6cp.h eui64.h
224      PPPDOBJS += ipv6cp.o eui64.o
225      CFLAGS   += -DINET6=1
226 endif
227
228 ifdef CBCP
229      PPPDSRCS += cbcp.c
230      PPPDOBJS += cbcp.o
231      CFLAGS += -DCBCP_SUPPORT
232      HEADERS += cbcp.h
233 endif
234
235 ifdef MAXOCTETS
236      CFLAGS += -DMAXOCTETS
237 endif
238
239 INSTALL= install
240
241 all: $(TARGETS)
242
243 install: pppd
244         $(INSTALL) -d $(BINDIR)
245         $(INSTALL) -d $(MANDIR)
246         $(INSTALL) -d $(PKGCONFDIR)
247         $(EXTRAINSTALL)
248         $(INSTALL) -c -m 755 pppd $(BINDIR)/pppd
249         if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
250           chmod o-rx,u+s $(BINDIR)/pppd; fi
251         $(INSTALL) -c -m 644 pppd.pc $(PKGCONFDIR)
252         $(INSTALL) -c -m 644 pppd.8 $(MANDIR)
253
254 pppd: $(PPPDOBJS)
255         $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_PLUGIN) -o pppd $(PPPDOBJS) $(LIBS)
256
257 srp-entry:      srp-entry.c
258         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
259
260 install-devel:
261         mkdir -p $(INCDIR)/pppd
262         $(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
263
264 clean:
265         rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
266
267 depend:
268         $(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend