1#
2# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# cmd/cmd-inet/usr.bin/pppd/Makefile
6#
7# Copyright (c) 2019, Joyent, Inc.
8
9include		../../../Makefile.cmd
10include		Makefile.def
11
12PROG=		pppd
13SUBDIRS=	plugins
14OBJS=		auth.o ccp.o chap.o demand.o fsm.o ipcp.o ipv6cp.o \
15		lcp.o magic.o main.o options.o sys-solaris.o upap.o utils.o \
16		multilink.o cbcp.o
17
18# Object tdb.o used only for Multilink; not supported yet.
19
20all:=		TARGET= all
21install:=	TARGET= install
22clean:=		TARGET= clean
23clobber:=	TARGET= clobber
24lint:=		TARGET= lint
25
26LDLIBS +=	-lpam -lmd -lsocket -lnsl -ldlpi
27
28#
29# We need absolute path to /etc/ppp/plugins and /usr/lib/inet/ppp, not
30# that of the proto area
31#
32LDFLAGS +=	-R$(ETCPPPPLUGINDIR_ABS) -R$(LIBPPPPLUGINDIR_ABS)
33
34CPPFLAGS +=	-DPLUGIN -DSVR4 -DSOL2 -DINET6
35CPPFLAGS +=	-D_PATH_VARRUN='"/var/run/"'
36CPPFLAGS +=	-DNEGOTIATE_FCS -DCBCP_SUPPORT -DALLOW_PAM -DHAS_SHADOW
37CPPFLAGS +=	-DHAVE_MMAP -DCOMP_TUNE -DMUX_FRAME
38$(NOT_RELEASE_BUILD)CPPFLAGS +=	-DDEBUG
39
40.KEEP_STATE:
41
42.PARALLEL:	$(SUBDIRS)
43
44all:		$(PROG) $(SUBDIRS)
45
46# MS-CHAP support
47CPPFLAGS +=	-DHAVE_CRYPT_H -DUSE_CRYPT -DHAVE_LIBMD
48CPPFLAGS +=	-DCHAPMS -DMSLANMAN
49CPPFLAGS +=	-DCHAPMSV2
50OBJS +=		chap_ms.o
51EXOBJS +=	mschap_test.o
52CLOBBERFILES +=	mschap_test
53
54CERRWARN +=	-_gcc=-Wno-uninitialized
55
56# main() is too hairy for smatch
57SMATCH=off
58
59# This is used *only* for testing the portability of the libraries
60# required for MS-CHAPv1.  It is not needed in any normal system and
61# is not built by default.
62mschap_test:	mschap_test.o chap_ms.o
63	$(LINK.c) -o mschap_test mschap_test.o chap_ms.o $(LDFLAGS) -lmd
64	@echo "Run with 'mschap_test 00000000000000000000000000000000 hello'"
65	@echo
66	@echo "Output should be:"
67	@echo
68	@echo " MS-CHAPv1 with LAN Manager -- 49 bytes:"
69	@echo "  C9 CA EE 9B 1C A7 87 04"
70	@echo "  79 36 8C 55 AB 88 EC 5A"
71	@echo "  57 E9 A1 B7 95 40 C3 74"
72	@echo "  F4 D9 9D AF 82 64 DC 3C"
73	@echo "  53 F9 BC 92 14 B5 5D 9E"
74	@echo "  78 C4 21 48 9D B7 A8 B4"
75	@echo "  01"
76	@echo "  MS-CHAPv2 -- 49 bytes:"
77	@echo "  xx xx xx xx xx xx xx xx"
78	@echo "  xx xx xx xx xx xx xx xx"
79	@echo "  00 00 00 00 00 00 00 00"
80	@echo "  xx xx xx xx xx xx xx xx"
81	@echo "  xx xx xx xx xx xx xx xx"
82	@echo "  xx xx xx xx xx xx xx xx"
83	@echo "  00"
84
85LINTFLAGS +=	-erroff=E_NAME_DEF_NOT_USED2
86
87SRCS=		$(OBJS:%.o=%.c)
88
89.PARALLEL:	$(OBJS)
90
91$(PROG):	$(OBJS)
92	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
93	$(POST_PROCESS)
94
95$(ROOTPROG):=	FILEMODE = 04555
96
97ASPPP2PPPD=	$(ROOTUSRSBIN)/asppp2pppd
98$(ASPPP2PPPD):=	FILEMODE = 0550
99
100install:	$(PROG) .WAIT $(SUBDIRS) $(ROOTPROG) $(ETCPPPDIR) $(ASPPP2PPPD)
101
102$(ETCPPPDIR)/%:	%
103	$(INS.file)
104
105$(ETCPPPDIR):
106	$(INS.dir)
107
108$(SUBDIRS):	FRC
109	@cd $@; pwd; $(MAKE) $(TARGET)
110
111FRC:
112
113LINTOBJS=$(OBJS:%.o=%.ln)
114CLOBBERFILES +=	$(LINTOBJS)
115
116clean:		$(SUBDIRS)
117	$(RM) $(OBJS) $(EXOBJS)
118
119sha1.ln:=	LINTFLAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
120
121# Not using the default lint target here so that we can disable
122# warnings per module as needed.
123lint:		$(SUBDIRS) $(LINTOBJS)
124	$(LINT.c) $(LINTOBJS) $(LDLIBS)
125
126clobber:	$(SUBDIRS)
127
128include		../../../Makefile.targ
129