xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.bin/Makefile (revision 8226594fdd4479be135127f43632f1f995074654)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26# Copyright 2016 Toomas Soome <tsoome@me.com>
27# Copyright (c) 2018, Joyent, Inc.
28# Copyright 2022 Garrett D'Amore
29#
30
31PROG=		finger rdate ruptime rwho whois
32SUIDPROG=	rcp rlogin rsh
33ALL=		$(PROG) $(SUIDPROG)
34SRCS=		$(ALL:%=%.c)
35KCMDPROGS=	rcp rlogin rsh
36
37SUBDIRS=	chat dns-sd ftp nc netstat \
38		pppd pppdump pppstats rdist talk telnet tftp
39SUBDIR1=	talk
40MSGSUBDIRS=	talk
41
42# As programs get lint-clean, add them here.  Eventually.
43# This hack should go away, and all in PROG should be lint-clean.
44# NB: This still applies to enabling compiler warnings and is not lint specific
45LINTCLEAN=	rlogin.c rsh.c rcp.c rdate.c rwho.c whois.c
46
47include ../../Makefile.cmd
48include ../Makefile.cmd-inet
49
50COMMONOBJS=	kcmd.o
51COMMONPOFILES=	$(COMMONOBJS:.o=.po)
52COMMONSRCS=	$(CMDINETCOMMONDIR)/$(COMMONOBJS:.o=.c)
53
54POFILES=	rlogin.po rsh.po rcp.po $(COMMONPOFILES)
55POFILE=		usr.bin.po
56
57CLOBBERFILES +=	$(ALL)
58CLEANFILES +=	kcmd.o rcp.o rlogin.o rsh.o
59
60all:=		TARGET= all
61install:=	TARGET= install
62clean:=		TARGET= clean
63clobber:=	TARGET= clobber
64_msg:=		TARGET= _msg
65
66ROOTSUIDPROG=	$(SUIDPROG:%=$(ROOTBIN)/%)
67$(ROOTSUIDPROG)	:=	FILEMODE=	04555
68
69CPPFLAGS +=	-DSYSV -DSTRNET -DBSD_COMP -I$(CMDINETCOMMONDIR)
70CERRWARN +=	-_gcc=-Wno-parentheses
71CERRWARN +=	$(CNOWARN_UNINIT)
72CERRWARN +=	-_gcc=-Wno-unused-function
73
74ruptime :=     SMOFF += leaks
75
76# Eventually just plain CFLAGS should be += -v, but not until all in
77# PROGS are lint clean.
78$(LINTCLEAN)	:=	CFLAGS += $(CCVERBOSE)
79
80finger :=	CFLAGS += $(CCVERBOSE)
81# Enable large file support for reading the lastlog file.
82finger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
83
84finger :=		LDLIBS += -lnsl -lcurses -lsocket
85rcp :=		LDLIBS += -lsocket -lsec -lsendfile
86rdate:=	LDLIBS += -lsocket
87rlogin :=	LDLIBS += -lnsl -lsocket
88rsh :=		LDLIBS += -lsocket
89whois :=	LDLIBS += -lsocket
90
91include  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
92$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
93$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(KRUNPATH) \
94				-L$(ROOT)$(KLIBDIR_DO) \
95				-L$(ROOT)$(KLIBDIR_GL)
96
97$(COMMONPOFILES) \
98rlogin.po rcp.po rsh.po \
99$(KCMDPROGS) :=	CPPFLAGS += -DKERBEROS \
100			-I$(CMDINETCOMMONDIR) \
101			-I$(SRC)/lib/gss_mechs/mech_krb5 \
102			-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
103			-I$(SRC)/lib/gss_mechs/mech_krb5/include \
104			-I$(SRC)/lib/gss_mechs/mech_krb5/include/krb5
105
106ROOTSUNWRCP=	$(ROOT)/usr/lib/sunw,rcp
107ROOTRSHSYMLINK=	$(ROOT)/usr/ucb/rsh
108ROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh
109
110.KEEP_STATE:
111
112all: $(ALL) $(SUBDIRS)
113
114install: all .WAIT $(ROOTPROG) $(ROOTSUIDPROG) \
115	$(SUBDIRS) $(ROOTSUNWRCP) $(ROOTRSHSYMLINK) $(ROOTREMSHSYMLINK)
116
117# Messaging - copy $POFILES to $POFILE to work with the parent directory
118# Makefile's '_msg' target.
119#
120_msg: $(MSGSUBDIRS) $(POFILES)
121	$(RM) $(POFILE)
122	$(CAT) $(POFILES)	> $(POFILE)
123
124$(COMMONPOFILES): $(COMMONSRCS)
125	$(COMPILE.cpp) $(COMMONSRCS) > $(@:.po=.c).i
126	$(XGETTEXT) $(XGETFLAGS) $(@:.po=.c).i
127	$(RM) $@
128	sed "/^domain/d" < messages.po  > $@
129	$(RM) messages.po $(@:.po=.c).i
130
131$(COMMONOBJS): $(COMMONSRCS)
132	$(COMPILE.c) $(COMMONSRCS)
133
134rlogin: rlogin.o $(COMMONOBJS)
135	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
136	$(POST_PROCESS)
137
138rcp: rcp.o $(COMMONOBJS)
139	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
140	$(POST_PROCESS)
141
142rsh: rsh.o $(COMMONOBJS)
143	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
144	$(POST_PROCESS)
145
146$(ROOTSUNWRCP):
147	$(RM) $@; $(SYMLINK) ../bin/rcp $@
148
149$(ROOTRSHSYMLINK):
150	$(RM) $@; $(SYMLINK) ../bin/rsh $@
151
152$(ROOTREMSHSYMLINK):
153	$(RM) $@; $(SYMLINK) rsh $@
154
155$(SUBDIRS): FRC
156	@cd $@; pwd; $(MAKE) $(TARGET)
157
158FRC:
159
160clean: $(SUBDIRS) clean_local
161clean_local:
162	$(RM) $(CLEANFILES)
163
164clobber: $(SUBDIRS) clobber_local
165clobber_local: clean_local
166	$(RM) $(CLOBBERFILES)
167
168