1#
2# pppd makefile for Linux
3# $Id$
4#
5
6include ../../config.in
7include ../../config.mk
8
9# Default installation locations
10BINDIR = $(TARGETDIR)/usr/sbin
11MANDIR = $(TARGETDIR)/usr/man/man8
12
13PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c \
14	   ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c cbcp.c \
15	   demand.c utils.c multilink.c tty.c
16HEADERS =  callout.h pathnames.h patchlevel.h chap.h md5.h chap_ms.h md4.h \
17	   ipxcp.h cbcp.h
18MANPAGES = pppd.8
19PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o \
20	   auth.o options.o demand.o utils.o sys-linux.o ipxcp.o multilink.o \
21	   tty.o
22
23all: pppd
24
25#
26# include dependancies if present and backup if as a header file
27ifeq (.depend,$(wildcard .depend))
28include .depend
29endif
30
31# CC = gcc
32#
33COPTS = -O2 -pipe -Wall -g
34LIBS =
35
36ifneq ($(wildcard /usr/lib/libcrypt.*),)
37# LIBS += -lcrypt
38LIBS += 
39endif
40
41# Uncomment the next 2 lines to include support for Microsoft's
42# MS-CHAP authentication protocol.
43#CHAPMS=y
44#USE_CRYPT=y
45#ifneq ($(wildcard /usr/lib/libcrypt.*),)
46#HAVE_CRYPT_H=y
47#endif
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, which it
52# doesn't yet.
53#FILTER=y
54
55#HAS_SHADOW=y
56#USE_PAM=y
57#HAVE_INET6=y
58
59#PLUGIN=y
60
61INCLUDE_DIRS= -I. -I../include
62
63#COMPILE_FLAGS= -D_linux_=1 -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP
64## IPX_CHANGE: IPX protocol
65## HAVE_MULTILINK: Muitiple link
66COMPILE_FLAGS= -D_linux_=1 -DHAVE_PATHS_H -DHAVE_MMAP
67
68CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS)
69
70ifdef CHAPMS
71CFLAGS   += -DCHAPMS=1
72ifndef USE_CRYPT
73LIBS     := -ldes $(LIBS)
74else
75CFLAGS   += -DUSE_CRYPT=1
76ifneq ($(wildcard /usr/include/crypt.h),)
77CFLAGS   += -DHAVE_CRYPT_H=1
78endif
79endif
80PPPDOBJS += md4.o chap_ms.o
81ifdef MSLANMAN
82CFLAGS   += -DMSLANMAN=1
83endif
84endif
85
86ifdef HAS_SHADOW
87CFLAGS   += -DHAS_SHADOW
88#LIBS     := -lshadow $(LIBS)
89endif
90
91# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
92ifdef USE_PAM
93CFLAGS   += -DUSE_PAM
94LIBS     := -lpam -ldl $(LIBS)
95endif
96
97# Lock library binary for Linux is included in 'linux' subdirectory.
98ifdef LOCKLIB
99LIBS     := -llock $(LIBS)
100CFLAGS   += -DLOCKLIB=1
101endif
102
103ifdef PLUGIN
104CFLAGS	+= -DPLUGIN
105LDFLAGS	+= -Wl,-E
106LIBS	+= -ldl
107endif
108
109ifdef FILTER
110LIBS    += -lpcap
111CFLAGS  += -DPPP_FILTER -I/usr/include/pcap
112endif
113
114ifdef HAVE_INET6
115     PPPDSRCS += ipv6cp.c eui64.c
116     HEADERS  += ipv6cp.h eui64.h
117     PPPDOBJS += ipv6cp.o eui64.o
118     CFLAGS   += -DINET6=1
119endif
120
121# Foxconn added start pling 06/02/2006 
122ifdef CCP_SUPPORT
123     PPPDSRCS += ccp.c
124     PPPDOBJS += ccp.o
125     CFLAGS   += -DCCP_SUPPORT
126endif
127
128ifdef TDB_SUPPORT
129     PPPDSRCS += tdb.c
130     HEADERS  += tdb.h
131     PPPDOBJS += tdb.o
132     CFLAGS   += -DTDB_SUPPORT
133endif
134# Foxconn added end pling 06/02/2006 
135
136INSTALL= install -o root
137
138install: pppd
139	mkdir -p $(BINDIR)
140	$(INSTALL) -s -c -m 755 pppd $(BINDIR)/pppd
141	if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
142	  chmod o-rx,u+s $(BINDIR)/pppd; fi
143#	mkdir -p $(MANDIR)
144#	$(INSTALL) -c -m 644 pppd.8 $(MANDIR)
145	$(STRIP) $(BINDIR)/pppd
146#	cd $(INSTALLDIR)/lib && rm -f libdl* && \
147#	cp $(TOOLPATH)/lib/libdl-0.9.28.so . && ln -s libdl-0.9.28.so libdl.so.0
148
149pppd: $(PPPDOBJS)
150	$(CC)  $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
151
152clean:
153	rm -f $(PPPDOBJS) pppd *~ #* core
154
155depend:
156	$(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
157