xref: /titanic_41/usr/src/cmd/cmd-inet/usr.bin/Makefile (revision b59b3655028aeb11832ad679eb5c2577c2b75235)
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#
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 whois.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
59CLOBBERFILES +=	$(ALL)
60CLEANFILES +=	kcmd.o rcp.o rlogin.o rsh.o
61
62all:=		TARGET= all
63install:=	TARGET= install
64clean:=		TARGET= clean
65clobber:=	TARGET= clobber
66lint:=		TARGET= lint
67_msg:=		TARGET= _msg
68
69ROOTSUIDPROG=	$(SUIDPROG:%=$(ROOTBIN)/%)
70$(ROOTSUIDPROG)	:=	FILEMODE=	04555
71
72CPPFLAGS +=	-DSYSV -DSTRNET -DBSD_COMP -I$(CMDINETCOMMONDIR)
73CERRWARN +=	-_gcc=-Wno-parentheses
74CERRWARN +=	-_gcc=-Wno-uninitialized
75CERRWARN +=	-_gcc=-Wno-unused-function
76
77# Eventually just plain CFLAGS should be += -v, but not until all in
78# PROGS are lint clean.
79$(LINTCLEAN)	:=	CFLAGS += $(CCVERBOSE)
80
81dns-sd :=	CFLAGS += $(C99_ENABLE)
82finger :=	CFLAGS += $(CCVERBOSE)
83# Enable large file support for reading the lastlog file.
84finger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
85
86dns-sd :=		LDLIBS += -lsocket -ldns_sd
87finger :=		LDLIBS += -lnsl -lcurses -lsocket
88rcp lint-rcp :=		LDLIBS += -lsocket -lsec -lsendfile
89rdate lint-rdate:=	LDLIBS += -lsocket
90rlogin lint-rlogin :=	LDLIBS += -lnsl -lsocket
91rsh lint-rsh :=		LDLIBS += -lsocket
92whois lint-whois :=	LDLIBS += -lsocket
93
94include  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
95$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
96$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(KRUNPATH) \
97				-L$(ROOT)$(KLIBDIR_DO) \
98				-L$(ROOT)$(KLIBDIR_GL)
99KCMDLINTS=	$(KCMDPROGS:%=lint-%)
100
101$(COMMONPOFILES) \
102rlogin.po rcp.po rsh.po \
103$(KCMDPROGS) \
104$(KCMDLINTS)	:=	CPPFLAGS += -DKERBEROS \
105			-I$(CMDINETCOMMONDIR) \
106			-I$(SRC)/lib/gss_mechs/mech_krb5 \
107			-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
108			-I$(SRC)/lib/gss_mechs/mech_krb5/include \
109			-I$(SRC)/lib/gss_mechs/mech_krb5/include/krb5
110
111# "-erroff=E_NAME_USED_NOT_DEF2" and "-erroff=E_NAME_DEF_NOT_USED2"
112# are required because lint problems in the Kerberos 5 framework.
113$(KCMDLINTS)	:=	LINTFLAGS += -lnsl \
114			-erroff=E_NAME_USED_NOT_DEF2 \
115			-erroff=E_NAME_DEF_NOT_USED2
116
117# Extra source files to lint with
118LINTXTRA=
119$(KCMDLINTS)	:=	LINTXTRA += $(COMMONSRCS)
120
121ROOTSUNWRCP=	$(ROOT)/usr/lib/sunw,rcp
122ROOTRSHSYMLINK=	$(ROOT)/usr/ucb/rsh
123ROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh
124
125.KEEP_STATE:
126
127all: $(ALL) $(SUBDIRS)
128
129install: all .WAIT $(ROOTPROG) $(ROOTSUIDPROG) \
130	$(SUBDIRS) $(ROOTSUNWRCP) $(ROOTRSHSYMLINK) $(ROOTREMSHSYMLINK)
131
132# Messaging - copy $POFILES to $POFILE to work with the parent directory
133# Makefile's '_msg' target.
134#
135_msg: $(MSGSUBDIRS) $(POFILES)
136	$(RM) $(POFILE)
137	$(CAT) $(POFILES)	> $(POFILE)
138
139$(COMMONPOFILES): $(COMMONSRCS)
140	$(COMPILE.cpp) $(COMMONSRCS) > $(@:.po=.c).i
141	$(XGETTEXT) $(XGETFLAGS) $(@:.po=.c).i
142	$(RM) $@
143	sed "/^domain/d" < messages.po  > $@
144	$(RM) messages.po $(@:.po=.c).i
145
146$(COMMONOBJS): $(COMMONSRCS)
147	$(COMPILE.c) $(COMMONSRCS)
148
149rlogin: rlogin.o $(COMMONOBJS)
150	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
151	$(POST_PROCESS)
152
153rcp: rcp.o $(COMMONOBJS)
154	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
155	$(POST_PROCESS)
156
157rsh: rsh.o $(COMMONOBJS)
158	$(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS)
159	$(POST_PROCESS)
160
161$(ROOTSUNWRCP):
162	$(RM) $@; $(SYMLINK) ../bin/rcp $@
163
164$(ROOTRSHSYMLINK):
165	$(RM) $@; $(SYMLINK) ../bin/rsh $@
166
167$(ROOTREMSHSYMLINK):
168	$(RM) $@; $(SYMLINK) rsh $@
169
170$(SUBDIRS): FRC
171	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
172
173FRC:
174
175clean: $(SUBDIRS) clean_local
176clean_local:
177	$(RM) $(CLEANFILES)
178
179clobber: $(SUBDIRS) clobber_local
180clobber_local: clean_local
181	$(RM) $(CLOBBERFILES)
182
183LINTLOCALS=	$(LINTCLEAN:%.c=lint-%)
184
185lint:	$(LINTSUBDIRS) $(LINTLOCALS)
186
187$(LINTLOCALS):
188	$(LINT.c) $(@:lint-%=%.c) $(LINTXTRA) $(LDLIBS)
189