xref: /titanic_41/usr/src/cmd/cmd-inet/usr.bin/Makefile (revision 20ae46ebaff1237662e05edf9db61538aa85d448)
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 nc nca netstat \
35		pppd pppdump pppstats rdist talk telnet tftp
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 rwho.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 pppstats 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
76dns-sd :=	CFLAGS += $(C99_ENABLE)
77finger :=	CFLAGS += $(CCVERBOSE)
78# Enable large file support for reading the lastlog file.
79finger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
80
81dns-sd :=		LDLIBS += -lsocket -ldns_sd
82finger :=		LDLIBS += -lnsl -lcurses -lsocket
83rcp lint-rcp :=		LDLIBS += -lsocket -lsec -lsendfile
84rdate lint-rdate:=	LDLIBS += -lsocket
85rlogin lint-rlogin :=	LDLIBS += -lnsl -lsocket
86rsh lint-rsh :=		LDLIBS += -lsocket
87whois :=		LDLIBS += -lnsl -lsocket
88
89include  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
90$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
91$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(ZLAZYLOAD) $(KRUNPATH) \
92				-L$(ROOT)$(KLIBDIR_DO) \
93				-L$(ROOT)$(KLIBDIR_GL)
94KCMDLINTS=	$(KCMDPROGS:%=lint-%)
95
96$(COMMONPOFILES) \
97rlogin.po rcp.po rsh.po \
98$(KCMDPROGS) \
99$(KCMDLINTS)	:=	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
106# "-erroff=E_NAME_USED_NOT_DEF2" and "-erroff=E_NAME_DEF_NOT_USED2"
107# are required because lint problems in the Kerberos 5 framework.
108$(KCMDLINTS)	:=	LINTFLAGS += -lnsl \
109			-erroff=E_NAME_USED_NOT_DEF2 \
110			-erroff=E_NAME_DEF_NOT_USED2
111
112# Extra source files to lint with
113LINTXTRA=
114$(KCMDLINTS)	:=	LINTXTRA += $(COMMONSRCS)
115
116ROOTSUNWRCP=	$(ROOT)/usr/lib/sunw,rcp
117ROOTRSHSYMLINK=	$(ROOT)/usr/ucb/rsh
118ROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh
119
120.KEEP_STATE:
121
122all: $(ALL) $(SUBDIRS)
123
124install: all .WAIT $(ROOTPROG) $(ROOTSUIDPROG) \
125	$(SUBDIRS) $(ROOTSUNWRCP) $(ROOTRSHSYMLINK) $(ROOTREMSHSYMLINK)
126
127# Messaging - copy $POFILES to $POFILE to work with the parent directory
128# Makefile's '_msg' target.
129#
130_msg: $(MSGSUBDIRS) $(POFILES)
131	$(RM) $(POFILE)
132	$(CAT) $(POFILES)	> $(POFILE)
133
134$(COMMONPOFILES): $(COMMONSRCS)
135	$(COMPILE.cpp) $(COMMONSRCS) > $(@:.po=.c).i
136	$(XGETTEXT) $(XGETFLAGS) $(@:.po=.c).i
137	$(RM) $@
138	sed "/^domain/d" < messages.po  > $@
139	$(RM) messages.po $(@:.po=.c).i
140
141$(COMMONOBJS): $(COMMONSRCS)
142	$(COMPILE.c) $(COMMONSRCS)
143
144rlogin: rlogin.o $(COMMONOBJS)
145	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
146	$(POST_PROCESS)
147
148rcp: rcp.o $(COMMONOBJS)
149	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
150	$(POST_PROCESS)
151
152rsh: rsh.o $(COMMONOBJS)
153	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
154	$(POST_PROCESS)
155
156$(ROOTSUNWRCP):
157	$(RM) $@; $(SYMLINK) ../bin/rcp $@
158
159$(ROOTRSHSYMLINK):
160	$(RM) $@; $(SYMLINK) ../bin/rsh $@
161
162$(ROOTREMSHSYMLINK):
163	$(RM) $@; $(SYMLINK) rsh $@
164
165$(SUBDIRS): FRC
166	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
167
168FRC:
169
170clean: $(SUBDIRS)
171
172clobber: $(SUBDIRS) clobber_local
173
174clobber_local:
175	echo $(CLOBBERFILES)
176	$(RM) $(ALL)  $(CLOBBERFILES)
177
178
179LINTLOCALS=	$(LINTCLEAN:%.c=lint-%)
180
181lint:	$(LINTSUBDIRS) $(LINTLOCALS)
182
183$(LINTLOCALS):
184	$(LINT.c) $(@:lint-%=%.c) $(LINTXTRA) $(LDLIBS)
185