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