xref: /onnv-gate/usr/src/cmd/cmd-inet/usr.bin/Makefile (revision 10207:87c40ea3fc4b)
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# CDDL HEADER START
30Sstevel@tonic-gate#
40Sstevel@tonic-gate# The contents of this file are subject to the terms of the
52546Scarlsonj# Common Development and Distribution License (the "License").
62546Scarlsonj# You may not use this file except in compliance with the License.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate# See the License for the specific language governing permissions
110Sstevel@tonic-gate# and limitations under the License.
120Sstevel@tonic-gate#
130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate#
190Sstevel@tonic-gate# CDDL HEADER END
200Sstevel@tonic-gate#
212923Sraf#
22*10207SJames.McPherson@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate# Use is subject to license terms.
240Sstevel@tonic-gate#
250Sstevel@tonic-gate
264904Srs200217PROG=		dns-sd finger rdate ruptime rwho whois
270Sstevel@tonic-gateSUIDPROG=	rcp rlogin rsh
280Sstevel@tonic-gateALL=		$(PROG) $(SUIDPROG)
290Sstevel@tonic-gateSRCS=		$(ALL:%=%.c)
300Sstevel@tonic-gateKCMDPROGS=	rcp rlogin rsh
310Sstevel@tonic-gate
325570Svk199839SUBDIRS=	chat ftp nc nca netstat \
335570Svk199839		pppd pppdump pppstats rdist talk telnet tftp
340Sstevel@tonic-gateSUBDIR1=	talk
350Sstevel@tonic-gateMSGSUBDIRS=	nca talk
360Sstevel@tonic-gate
370Sstevel@tonic-gate# As programs get lint-clean, add them here.  Eventually.
380Sstevel@tonic-gate# This hack should go away, and all in PROG should be lint-clean.
392546ScarlsonjLINTCLEAN=	rlogin.c rsh.c rcp.c rdate.c rwho.c
400Sstevel@tonic-gate
410Sstevel@tonic-gate# Likewise, as subdirs get lint-clean, add them here.  Once
420Sstevel@tonic-gate# they're all clean, replace the dependency of the lint target
430Sstevel@tonic-gate# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
440Sstevel@tonic-gate# for the lint rule.
452546ScarlsonjLINTSUBDIRS=	nca netstat pppd pppstats tftp
460Sstevel@tonic-gate
470Sstevel@tonic-gateinclude ../../Makefile.cmd
480Sstevel@tonic-gateinclude ../Makefile.cmd-inet
490Sstevel@tonic-gate
500Sstevel@tonic-gateCOMMONOBJS=	kcmd.o
510Sstevel@tonic-gateCOMMONPOFILES=	$(COMMONOBJS:.o=.po)
520Sstevel@tonic-gateCOMMONSRCS=	$(CMDINETCOMMONDIR)/$(COMMONOBJS:.o=.c)
530Sstevel@tonic-gate
540Sstevel@tonic-gatePOFILES=	rlogin.po rsh.po rcp.po $(COMMONPOFILES)
550Sstevel@tonic-gatePOFILE=		usr.bin.po
560Sstevel@tonic-gate
570Sstevel@tonic-gateall:=		TARGET= all
580Sstevel@tonic-gateinstall:=	TARGET= install
590Sstevel@tonic-gateclean:=		TARGET= clean
600Sstevel@tonic-gateclobber:=	TARGET= clobber
610Sstevel@tonic-gatelint:=		TARGET= lint
620Sstevel@tonic-gate_msg:=		TARGET= _msg
630Sstevel@tonic-gate
640Sstevel@tonic-gateROOTSUIDPROG=	$(SUIDPROG:%=$(ROOTBIN)/%)
650Sstevel@tonic-gate$(ROOTSUIDPROG)	:=	FILEMODE=	04555
660Sstevel@tonic-gate
670Sstevel@tonic-gateCPPFLAGS +=	-DSYSV -DSTRNET -DBSD_COMP -I$(CMDINETCOMMONDIR)
680Sstevel@tonic-gate
690Sstevel@tonic-gate# Eventually just plain CFLAGS should be += -v, but not until all in
700Sstevel@tonic-gate# PROGS are lint clean.
710Sstevel@tonic-gate$(LINTCLEAN)	:=	CFLAGS += $(CCVERBOSE)
720Sstevel@tonic-gate
734904Srs200217dns-sd :=	CFLAGS += $(C99_ENABLE)
740Sstevel@tonic-gatefinger :=	CFLAGS += $(CCVERBOSE)
750Sstevel@tonic-gate# Enable large file support for reading the lastlog file.
760Sstevel@tonic-gatefinger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
770Sstevel@tonic-gate
784904Srs200217dns-sd :=		LDLIBS += -lsocket -ldns_sd
792923Sraffinger :=		LDLIBS += -lnsl -lcurses -lsocket
800Sstevel@tonic-gatercp lint-rcp :=		LDLIBS += -lsocket -lsec -lsendfile
810Sstevel@tonic-gaterdate lint-rdate:=	LDLIBS += -lsocket
820Sstevel@tonic-gaterlogin lint-rlogin :=	LDLIBS += -lnsl -lsocket
830Sstevel@tonic-gatersh lint-rsh :=		LDLIBS += -lsocket
847448Sderekmorr@psu.eduwhois :=		LDLIBS += -lsocket
850Sstevel@tonic-gate
860Sstevel@tonic-gateinclude  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
870Sstevel@tonic-gate$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
886543Srie$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(KRUNPATH) \
890Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_DO) \
900Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_GL)
910Sstevel@tonic-gateKCMDLINTS=	$(KCMDPROGS:%=lint-%)
920Sstevel@tonic-gate
930Sstevel@tonic-gate$(COMMONPOFILES) \
940Sstevel@tonic-gaterlogin.po rcp.po rsh.po \
950Sstevel@tonic-gate$(KCMDPROGS) \
960Sstevel@tonic-gate$(KCMDLINTS)	:=	CPPFLAGS += -DKERBEROS \
970Sstevel@tonic-gate			-I$(CMDINETCOMMONDIR) \
980Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5 \
990Sstevel@tonic-gate			-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
1000Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5/include \
1010Sstevel@tonic-gate			-I$(SRC)/lib/gss_mechs/mech_krb5/include/krb5
1020Sstevel@tonic-gate
1030Sstevel@tonic-gate# "-erroff=E_NAME_USED_NOT_DEF2" and "-erroff=E_NAME_DEF_NOT_USED2"
1040Sstevel@tonic-gate# are required because lint problems in the Kerberos 5 framework.
1050Sstevel@tonic-gate$(KCMDLINTS)	:=	LINTFLAGS += -lnsl \
1060Sstevel@tonic-gate			-erroff=E_NAME_USED_NOT_DEF2 \
1070Sstevel@tonic-gate			-erroff=E_NAME_DEF_NOT_USED2
1080Sstevel@tonic-gate
1090Sstevel@tonic-gate# Extra source files to lint with
1100Sstevel@tonic-gateLINTXTRA=
1110Sstevel@tonic-gate$(KCMDLINTS)	:=	LINTXTRA += $(COMMONSRCS)
1120Sstevel@tonic-gate
1130Sstevel@tonic-gateROOTSUNWRCP=	$(ROOT)/usr/lib/sunw,rcp
1140Sstevel@tonic-gateROOTRSHSYMLINK=	$(ROOT)/usr/ucb/rsh
1150Sstevel@tonic-gateROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh
1160Sstevel@tonic-gate
1170Sstevel@tonic-gate.KEEP_STATE:
1180Sstevel@tonic-gate
1190Sstevel@tonic-gateall: $(ALL) $(SUBDIRS)
1200Sstevel@tonic-gate
1210Sstevel@tonic-gateinstall: all .WAIT $(ROOTPROG) $(ROOTSUIDPROG) \
1220Sstevel@tonic-gate	$(SUBDIRS) $(ROOTSUNWRCP) $(ROOTRSHSYMLINK) $(ROOTREMSHSYMLINK)
1230Sstevel@tonic-gate
1240Sstevel@tonic-gate# Messaging - copy $POFILES to $POFILE to work with the parent directory
1250Sstevel@tonic-gate# Makefile's '_msg' target.
1260Sstevel@tonic-gate#
1270Sstevel@tonic-gate_msg: $(MSGSUBDIRS) $(POFILES)
1280Sstevel@tonic-gate	$(RM) $(POFILE)
1290Sstevel@tonic-gate	$(CAT) $(POFILES)	> $(POFILE)
1300Sstevel@tonic-gate
1310Sstevel@tonic-gate$(COMMONPOFILES): $(COMMONSRCS)
1320Sstevel@tonic-gate	$(COMPILE.cpp) $(COMMONSRCS) > $(@:.po=.c).i
1330Sstevel@tonic-gate	$(XGETTEXT) $(XGETFLAGS) $(@:.po=.c).i
1340Sstevel@tonic-gate	$(RM) $@
1350Sstevel@tonic-gate	sed "/^domain/d" < messages.po  > $@
1360Sstevel@tonic-gate	$(RM) messages.po $(@:.po=.c).i
1370Sstevel@tonic-gate
1380Sstevel@tonic-gate$(COMMONOBJS): $(COMMONSRCS)
1390Sstevel@tonic-gate	$(COMPILE.c) $(COMMONSRCS)
1400Sstevel@tonic-gate
1410Sstevel@tonic-gaterlogin: rlogin.o $(COMMONOBJS)
1420Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
1430Sstevel@tonic-gate	$(POST_PROCESS)
1440Sstevel@tonic-gate
1450Sstevel@tonic-gatercp: rcp.o $(COMMONOBJS)
1460Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
1470Sstevel@tonic-gate	$(POST_PROCESS)
1480Sstevel@tonic-gate
1490Sstevel@tonic-gatersh: rsh.o $(COMMONOBJS)
1500Sstevel@tonic-gate	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
1510Sstevel@tonic-gate	$(POST_PROCESS)
1520Sstevel@tonic-gate
1530Sstevel@tonic-gate$(ROOTSUNWRCP):
1540Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../bin/rcp $@
1550Sstevel@tonic-gate
1560Sstevel@tonic-gate$(ROOTRSHSYMLINK):
1570Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../bin/rsh $@
1580Sstevel@tonic-gate
1590Sstevel@tonic-gate$(ROOTREMSHSYMLINK):
1600Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) rsh $@
1610Sstevel@tonic-gate
1620Sstevel@tonic-gate$(SUBDIRS): FRC
1630Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
1640Sstevel@tonic-gate
1650Sstevel@tonic-gateFRC:
1660Sstevel@tonic-gate
1670Sstevel@tonic-gateclean: $(SUBDIRS)
1680Sstevel@tonic-gate
1690Sstevel@tonic-gateclobber: $(SUBDIRS) clobber_local
1700Sstevel@tonic-gate
1710Sstevel@tonic-gateclobber_local:
1720Sstevel@tonic-gate	echo $(CLOBBERFILES)
1730Sstevel@tonic-gate	$(RM) $(ALL)  $(CLOBBERFILES)
1740Sstevel@tonic-gate
1750Sstevel@tonic-gate
1760Sstevel@tonic-gateLINTLOCALS=	$(LINTCLEAN:%.c=lint-%)
1770Sstevel@tonic-gate
1780Sstevel@tonic-gatelint:	$(LINTSUBDIRS) $(LINTLOCALS)
1790Sstevel@tonic-gate
1800Sstevel@tonic-gate$(LINTLOCALS):
1810Sstevel@tonic-gate	$(LINT.c) $(@:lint-%=%.c) $(LINTXTRA) $(LDLIBS)
182