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