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