1*7c478bd9Sstevel@tonic-gate#
2*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate#
4*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate# with the License.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate# and limitations under the License.
13*7c478bd9Sstevel@tonic-gate#
14*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate#
20*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate#
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate#
26*7c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gatePROG=		finger rdate ruptime rwho whois
30*7c478bd9Sstevel@tonic-gateSUIDPROG=	rcp rlogin rsh
31*7c478bd9Sstevel@tonic-gateALL=		$(PROG) $(SUIDPROG)
32*7c478bd9Sstevel@tonic-gateSRCS=		$(ALL:%=%.c)
33*7c478bd9Sstevel@tonic-gateKCMDPROGS=	rcp rlogin rsh
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gateSUBDIRS=	chat ftp nca netstat pppd pppdump pppstats rdist talk tftp telnet
36*7c478bd9Sstevel@tonic-gateSUBDIR1=	talk
37*7c478bd9Sstevel@tonic-gateMSGSUBDIRS=	nca talk
38*7c478bd9Sstevel@tonic-gate
39*7c478bd9Sstevel@tonic-gate# As programs get lint-clean, add them here.  Eventually.
40*7c478bd9Sstevel@tonic-gate# This hack should go away, and all in PROG should be lint-clean.
41*7c478bd9Sstevel@tonic-gateLINTCLEAN=	rlogin.c rsh.c rcp.c rdate.c
42*7c478bd9Sstevel@tonic-gate
43*7c478bd9Sstevel@tonic-gate# Likewise, as subdirs get lint-clean, add them here.  Once
44*7c478bd9Sstevel@tonic-gate# they're all clean, replace the dependency of the lint target
45*7c478bd9Sstevel@tonic-gate# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
46*7c478bd9Sstevel@tonic-gate# for the lint rule.
47*7c478bd9Sstevel@tonic-gateLINTSUBDIRS=	nca netstat pppd tftp
48*7c478bd9Sstevel@tonic-gate
49*7c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
50*7c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd-inet
51*7c478bd9Sstevel@tonic-gate
52*7c478bd9Sstevel@tonic-gateCOMMONOBJS=	kcmd.o
53*7c478bd9Sstevel@tonic-gateCOMMONPOFILES=	$(COMMONOBJS:.o=.po)
54*7c478bd9Sstevel@tonic-gateCOMMONSRCS=	$(CMDINETCOMMONDIR)/$(COMMONOBJS:.o=.c)
55*7c478bd9Sstevel@tonic-gate
56*7c478bd9Sstevel@tonic-gatePOFILES=	rlogin.po rsh.po rcp.po $(COMMONPOFILES)
57*7c478bd9Sstevel@tonic-gatePOFILE=		usr.bin.po
58*7c478bd9Sstevel@tonic-gate
59*7c478bd9Sstevel@tonic-gateall:=		TARGET= all
60*7c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
61*7c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
62*7c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
63*7c478bd9Sstevel@tonic-gatelint:=		TARGET= lint
64*7c478bd9Sstevel@tonic-gate_msg:=		TARGET= _msg
65*7c478bd9Sstevel@tonic-gate
66*7c478bd9Sstevel@tonic-gateROOTSUIDPROG=	$(SUIDPROG:%=$(ROOTBIN)/%)
67*7c478bd9Sstevel@tonic-gate$(ROOTSUIDPROG)	:=	FILEMODE=	04555
68*7c478bd9Sstevel@tonic-gate$(ROOTSUIDPROG)	:=	OWNER=		root
69*7c478bd9Sstevel@tonic-gate
70*7c478bd9Sstevel@tonic-gateCPPFLAGS +=	-DSYSV -DSTRNET -DBSD_COMP -I$(CMDINETCOMMONDIR)
71*7c478bd9Sstevel@tonic-gate
72*7c478bd9Sstevel@tonic-gate# Eventually just plain CFLAGS should be += -v, but not until all in
73*7c478bd9Sstevel@tonic-gate# PROGS are lint clean.
74*7c478bd9Sstevel@tonic-gate$(LINTCLEAN)	:=	CFLAGS += $(CCVERBOSE)
75*7c478bd9Sstevel@tonic-gate
76*7c478bd9Sstevel@tonic-gatefinger :=	CFLAGS += $(CCVERBOSE)
77*7c478bd9Sstevel@tonic-gate# Enable large file support for reading the lastlog file.
78*7c478bd9Sstevel@tonic-gatefinger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
79*7c478bd9Sstevel@tonic-gate
80*7c478bd9Sstevel@tonic-gatefinger :=		LDLIBS += -lnsl -lcurses -lcmd -lsocket
81*7c478bd9Sstevel@tonic-gatercp lint-rcp :=		LDLIBS += -lsocket -lsec -lsendfile
82*7c478bd9Sstevel@tonic-gaterdate lint-rdate:=	LDLIBS += -lsocket
83*7c478bd9Sstevel@tonic-gaterlogin lint-rlogin :=	LDLIBS += -lnsl -lsocket
84*7c478bd9Sstevel@tonic-gatersh lint-rsh :=		LDLIBS += -lsocket
85*7c478bd9Sstevel@tonic-gatewhois :=		LDLIBS += -lnsl -lsocket
86*7c478bd9Sstevel@tonic-gate
87*7c478bd9Sstevel@tonic-gateinclude  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
88*7c478bd9Sstevel@tonic-gate$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
89*7c478bd9Sstevel@tonic-gate$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(ZLAZYLOAD) $(KRUNPATH) \
90*7c478bd9Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_DO) \
91*7c478bd9Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_GL)
92*7c478bd9Sstevel@tonic-gateKCMDLINTS=	$(KCMDPROGS:%=lint-%)
93*7c478bd9Sstevel@tonic-gate
94*7c478bd9Sstevel@tonic-gate$(COMMONPOFILES) \
95*7c478bd9Sstevel@tonic-gaterlogin.po rcp.po rsh.po \
96*7c478bd9Sstevel@tonic-gate$(KCMDPROGS) \
97*7c478bd9Sstevel@tonic-gate$(KCMDLINTS)	:=	CPPFLAGS += -DKERBEROS \
98*7c478bd9Sstevel@tonic-gate			-I$(CMDINETCOMMONDIR) \
99*7c478bd9Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5 \
100*7c478bd9Sstevel@tonic-gate			-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
101*7c478bd9Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5/include \
102*7c478bd9Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5/include/krb5
103*7c478bd9Sstevel@tonic-gate
104*7c478bd9Sstevel@tonic-gate# "-erroff=E_NAME_USED_NOT_DEF2" and "-erroff=E_NAME_DEF_NOT_USED2"
105*7c478bd9Sstevel@tonic-gate# are required because lint problems in the Kerberos 5 framework.
106*7c478bd9Sstevel@tonic-gate$(KCMDLINTS)	:=	LINTFLAGS += -lnsl \
107*7c478bd9Sstevel@tonic-gate			-erroff=E_NAME_USED_NOT_DEF2 \
108*7c478bd9Sstevel@tonic-gate			-erroff=E_NAME_DEF_NOT_USED2
109*7c478bd9Sstevel@tonic-gate
110*7c478bd9Sstevel@tonic-gate# Extra source files to lint with
111*7c478bd9Sstevel@tonic-gateLINTXTRA=
112*7c478bd9Sstevel@tonic-gate$(KCMDLINTS)	:=	LINTXTRA += $(COMMONSRCS)
113*7c478bd9Sstevel@tonic-gate
114*7c478bd9Sstevel@tonic-gateROOTSUNWRCP=	$(ROOT)/usr/lib/sunw,rcp
115*7c478bd9Sstevel@tonic-gateROOTRSHSYMLINK=	$(ROOT)/usr/ucb/rsh
116*7c478bd9Sstevel@tonic-gateROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh
117*7c478bd9Sstevel@tonic-gate
118*7c478bd9Sstevel@tonic-gate.KEEP_STATE:
119*7c478bd9Sstevel@tonic-gate
120*7c478bd9Sstevel@tonic-gateall: $(ALL) $(SUBDIRS)
121*7c478bd9Sstevel@tonic-gate
122*7c478bd9Sstevel@tonic-gateinstall: all .WAIT $(ROOTPROG) $(ROOTSUIDPROG) \
123*7c478bd9Sstevel@tonic-gate	$(SUBDIRS) $(ROOTSUNWRCP) $(ROOTRSHSYMLINK) $(ROOTREMSHSYMLINK)
124*7c478bd9Sstevel@tonic-gate
125*7c478bd9Sstevel@tonic-gate# Messaging - copy $POFILES to $POFILE to work with the parent directory
126*7c478bd9Sstevel@tonic-gate# Makefile's '_msg' target.
127*7c478bd9Sstevel@tonic-gate#
128*7c478bd9Sstevel@tonic-gate_msg: $(MSGSUBDIRS) $(POFILES)
129*7c478bd9Sstevel@tonic-gate	$(RM) $(POFILE)
130*7c478bd9Sstevel@tonic-gate	$(CAT) $(POFILES)	> $(POFILE)
131*7c478bd9Sstevel@tonic-gate
132*7c478bd9Sstevel@tonic-gate$(COMMONPOFILES): $(COMMONSRCS)
133*7c478bd9Sstevel@tonic-gate	$(COMPILE.cpp) $(COMMONSRCS) > $(@:.po=.c).i
134*7c478bd9Sstevel@tonic-gate	$(XGETTEXT) $(XGETFLAGS) $(@:.po=.c).i
135*7c478bd9Sstevel@tonic-gate	$(RM) $@
136*7c478bd9Sstevel@tonic-gate	sed "/^domain/d" < messages.po  > $@
137*7c478bd9Sstevel@tonic-gate	$(RM) messages.po $(@:.po=.c).i
138*7c478bd9Sstevel@tonic-gate
139*7c478bd9Sstevel@tonic-gate$(COMMONOBJS): $(COMMONSRCS)
140*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) $(COMMONSRCS)
141*7c478bd9Sstevel@tonic-gate
142*7c478bd9Sstevel@tonic-gaterlogin: rlogin.o $(COMMONOBJS)
143*7c478bd9Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
144*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
145*7c478bd9Sstevel@tonic-gate
146*7c478bd9Sstevel@tonic-gatercp: rcp.o $(COMMONOBJS)
147*7c478bd9Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
148*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
149*7c478bd9Sstevel@tonic-gate
150*7c478bd9Sstevel@tonic-gatersh: rsh.o $(COMMONOBJS)
151*7c478bd9Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
152*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
153*7c478bd9Sstevel@tonic-gate
154*7c478bd9Sstevel@tonic-gate$(ROOTSUNWRCP):
155*7c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../bin/rcp $@
156*7c478bd9Sstevel@tonic-gate
157*7c478bd9Sstevel@tonic-gate$(ROOTRSHSYMLINK):
158*7c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../bin/rsh $@
159*7c478bd9Sstevel@tonic-gate
160*7c478bd9Sstevel@tonic-gate$(ROOTREMSHSYMLINK):
161*7c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) rsh $@
162*7c478bd9Sstevel@tonic-gate
163*7c478bd9Sstevel@tonic-gate$(SUBDIRS): FRC
164*7c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
165*7c478bd9Sstevel@tonic-gate
166*7c478bd9Sstevel@tonic-gateFRC:
167*7c478bd9Sstevel@tonic-gate
168*7c478bd9Sstevel@tonic-gateclean: $(SUBDIRS)
169*7c478bd9Sstevel@tonic-gate
170*7c478bd9Sstevel@tonic-gateclobber: $(SUBDIRS) clobber_local
171*7c478bd9Sstevel@tonic-gate
172*7c478bd9Sstevel@tonic-gateclobber_local:
173*7c478bd9Sstevel@tonic-gate	echo $(CLOBBERFILES)
174*7c478bd9Sstevel@tonic-gate	$(RM) $(ALL)  $(CLOBBERFILES)
175*7c478bd9Sstevel@tonic-gate
176*7c478bd9Sstevel@tonic-gate
177*7c478bd9Sstevel@tonic-gateLINTLOCALS=	$(LINTCLEAN:%.c=lint-%)
178*7c478bd9Sstevel@tonic-gate
179*7c478bd9Sstevel@tonic-gatelint:	$(LINTSUBDIRS) $(LINTLOCALS)
180*7c478bd9Sstevel@tonic-gate
181*7c478bd9Sstevel@tonic-gate$(LINTLOCALS):
182*7c478bd9Sstevel@tonic-gate	$(LINT.c) $(@:lint-%=%.c) $(LINTXTRA) $(LDLIBS)
183