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