xref: /titanic_51/usr/src/cmd/cmd-inet/usr.bin/Makefile (revision 5ffb0c9b03b5149ff4f5821a62be4a52408ada2a)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
569bb4bb4Scarlsonj# Common Development and Distribution License (the "License").
669bb4bb4Scarlsonj# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
2106e1a714Sraf#
2224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
251dd3983cSYuri Pankov# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26*5ffb0c9bSToomas Soome# Copyright 2016 Toomas Soome <tsoome@me.com>
271dd3983cSYuri Pankov#
287c478bd9Sstevel@tonic-gate
29*5ffb0c9bSToomas SoomePROG=		finger rdate ruptime rwho whois
307c478bd9Sstevel@tonic-gateSUIDPROG=	rcp rlogin rsh
317c478bd9Sstevel@tonic-gateALL=		$(PROG) $(SUIDPROG)
327c478bd9Sstevel@tonic-gateSRCS=		$(ALL:%=%.c)
337c478bd9Sstevel@tonic-gateKCMDPROGS=	rcp rlogin rsh
347c478bd9Sstevel@tonic-gate
35*5ffb0c9bSToomas SoomeSUBDIRS=	chat dns-sd ftp nc nca netstat \
3603100a63Svk199839		pppd pppdump pppstats rdist talk telnet tftp
377c478bd9Sstevel@tonic-gateSUBDIR1=	talk
387c478bd9Sstevel@tonic-gateMSGSUBDIRS=	nca talk
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate# As programs get lint-clean, add them here.  Eventually.
417c478bd9Sstevel@tonic-gate# This hack should go away, and all in PROG should be lint-clean.
421dd3983cSYuri PankovLINTCLEAN=	rlogin.c rsh.c rcp.c rdate.c rwho.c whois.c
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate# Likewise, as subdirs get lint-clean, add them here.  Once
457c478bd9Sstevel@tonic-gate# they're all clean, replace the dependency of the lint target
467c478bd9Sstevel@tonic-gate# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
477c478bd9Sstevel@tonic-gate# for the lint rule.
4869bb4bb4ScarlsonjLINTSUBDIRS=	nca netstat pppd pppstats tftp
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
517c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd-inet
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateCOMMONOBJS=	kcmd.o
547c478bd9Sstevel@tonic-gateCOMMONPOFILES=	$(COMMONOBJS:.o=.po)
557c478bd9Sstevel@tonic-gateCOMMONSRCS=	$(CMDINETCOMMONDIR)/$(COMMONOBJS:.o=.c)
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gatePOFILES=	rlogin.po rsh.po rcp.po $(COMMONPOFILES)
587c478bd9Sstevel@tonic-gatePOFILE=		usr.bin.po
597c478bd9Sstevel@tonic-gate
60b6805bf7SGordon RossCLOBBERFILES +=	$(ALL)
61b6805bf7SGordon RossCLEANFILES +=	kcmd.o rcp.o rlogin.o rsh.o
62b6805bf7SGordon Ross
637c478bd9Sstevel@tonic-gateall:=		TARGET= all
647c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
657c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
667c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
677c478bd9Sstevel@tonic-gatelint:=		TARGET= lint
687c478bd9Sstevel@tonic-gate_msg:=		TARGET= _msg
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gateROOTSUIDPROG=	$(SUIDPROG:%=$(ROOTBIN)/%)
717c478bd9Sstevel@tonic-gate$(ROOTSUIDPROG)	:=	FILEMODE=	04555
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateCPPFLAGS +=	-DSYSV -DSTRNET -DBSD_COMP -I$(CMDINETCOMMONDIR)
747014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
757014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
767014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-function
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate# Eventually just plain CFLAGS should be += -v, but not until all in
797c478bd9Sstevel@tonic-gate# PROGS are lint clean.
807c478bd9Sstevel@tonic-gate$(LINTCLEAN)	:=	CFLAGS += $(CCVERBOSE)
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gatefinger :=	CFLAGS += $(CCVERBOSE)
837c478bd9Sstevel@tonic-gate# Enable large file support for reading the lastlog file.
847c478bd9Sstevel@tonic-gatefinger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
857c478bd9Sstevel@tonic-gate
8606e1a714Sraffinger :=		LDLIBS += -lnsl -lcurses -lsocket
877c478bd9Sstevel@tonic-gatercp lint-rcp :=		LDLIBS += -lsocket -lsec -lsendfile
887c478bd9Sstevel@tonic-gaterdate lint-rdate:=	LDLIBS += -lsocket
897c478bd9Sstevel@tonic-gaterlogin lint-rlogin :=	LDLIBS += -lnsl -lsocket
907c478bd9Sstevel@tonic-gatersh lint-rsh :=		LDLIBS += -lsocket
911dd3983cSYuri Pankovwhois lint-whois :=	LDLIBS += -lsocket
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gateinclude  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
947c478bd9Sstevel@tonic-gate$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
9567e3a03eSrie$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(KRUNPATH) \
967c478bd9Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_DO) \
977c478bd9Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_GL)
987c478bd9Sstevel@tonic-gateKCMDLINTS=	$(KCMDPROGS:%=lint-%)
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate$(COMMONPOFILES) \
1017c478bd9Sstevel@tonic-gaterlogin.po rcp.po rsh.po \
1027c478bd9Sstevel@tonic-gate$(KCMDPROGS) \
1037c478bd9Sstevel@tonic-gate$(KCMDLINTS)	:=	CPPFLAGS += -DKERBEROS \
1047c478bd9Sstevel@tonic-gate			-I$(CMDINETCOMMONDIR) \
1057c478bd9Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5 \
1067c478bd9Sstevel@tonic-gate			-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
1077c478bd9Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5/include \
1087c478bd9Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5/include/krb5
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate# "-erroff=E_NAME_USED_NOT_DEF2" and "-erroff=E_NAME_DEF_NOT_USED2"
1117c478bd9Sstevel@tonic-gate# are required because lint problems in the Kerberos 5 framework.
1127c478bd9Sstevel@tonic-gate$(KCMDLINTS)	:=	LINTFLAGS += -lnsl \
1137c478bd9Sstevel@tonic-gate			-erroff=E_NAME_USED_NOT_DEF2 \
1147c478bd9Sstevel@tonic-gate			-erroff=E_NAME_DEF_NOT_USED2
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate# Extra source files to lint with
1177c478bd9Sstevel@tonic-gateLINTXTRA=
1187c478bd9Sstevel@tonic-gate$(KCMDLINTS)	:=	LINTXTRA += $(COMMONSRCS)
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gateROOTSUNWRCP=	$(ROOT)/usr/lib/sunw,rcp
1217c478bd9Sstevel@tonic-gateROOTRSHSYMLINK=	$(ROOT)/usr/ucb/rsh
1227c478bd9Sstevel@tonic-gateROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gate.KEEP_STATE:
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gateall: $(ALL) $(SUBDIRS)
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gateinstall: all .WAIT $(ROOTPROG) $(ROOTSUIDPROG) \
1297c478bd9Sstevel@tonic-gate	$(SUBDIRS) $(ROOTSUNWRCP) $(ROOTRSHSYMLINK) $(ROOTREMSHSYMLINK)
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate# Messaging - copy $POFILES to $POFILE to work with the parent directory
1327c478bd9Sstevel@tonic-gate# Makefile's '_msg' target.
1337c478bd9Sstevel@tonic-gate#
1347c478bd9Sstevel@tonic-gate_msg: $(MSGSUBDIRS) $(POFILES)
1357c478bd9Sstevel@tonic-gate	$(RM) $(POFILE)
1367c478bd9Sstevel@tonic-gate	$(CAT) $(POFILES)	> $(POFILE)
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gate$(COMMONPOFILES): $(COMMONSRCS)
1397c478bd9Sstevel@tonic-gate	$(COMPILE.cpp) $(COMMONSRCS) > $(@:.po=.c).i
1407c478bd9Sstevel@tonic-gate	$(XGETTEXT) $(XGETFLAGS) $(@:.po=.c).i
1417c478bd9Sstevel@tonic-gate	$(RM) $@
1427c478bd9Sstevel@tonic-gate	sed "/^domain/d" < messages.po  > $@
1437c478bd9Sstevel@tonic-gate	$(RM) messages.po $(@:.po=.c).i
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate$(COMMONOBJS): $(COMMONSRCS)
1467c478bd9Sstevel@tonic-gate	$(COMPILE.c) $(COMMONSRCS)
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gaterlogin: rlogin.o $(COMMONOBJS)
1497c478bd9Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
1507c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gatercp: rcp.o $(COMMONOBJS)
1537c478bd9Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
1547c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gatersh: rsh.o $(COMMONOBJS)
1577c478bd9Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
1587c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1597c478bd9Sstevel@tonic-gate
1607c478bd9Sstevel@tonic-gate$(ROOTSUNWRCP):
1617c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../bin/rcp $@
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate$(ROOTRSHSYMLINK):
1647c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../bin/rsh $@
1657c478bd9Sstevel@tonic-gate
1667c478bd9Sstevel@tonic-gate$(ROOTREMSHSYMLINK):
1677c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) rsh $@
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gate$(SUBDIRS): FRC
1707c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
1717c478bd9Sstevel@tonic-gate
1727c478bd9Sstevel@tonic-gateFRC:
1737c478bd9Sstevel@tonic-gate
174b6805bf7SGordon Rossclean: $(SUBDIRS) clean_local
175b6805bf7SGordon Rossclean_local:
176b6805bf7SGordon Ross	$(RM) $(CLEANFILES)
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gateclobber: $(SUBDIRS) clobber_local
179b6805bf7SGordon Rossclobber_local: clean_local
180b6805bf7SGordon Ross	$(RM) $(CLOBBERFILES)
1817c478bd9Sstevel@tonic-gate
1827c478bd9Sstevel@tonic-gateLINTLOCALS=	$(LINTCLEAN:%.c=lint-%)
1837c478bd9Sstevel@tonic-gate
1847c478bd9Sstevel@tonic-gatelint:	$(LINTSUBDIRS) $(LINTLOCALS)
1857c478bd9Sstevel@tonic-gate
1867c478bd9Sstevel@tonic-gate$(LINTLOCALS):
1877c478bd9Sstevel@tonic-gate	$(LINT.c) $(@:lint-%=%.c) $(LINTXTRA) $(LDLIBS)
188