xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.bin/Makefile (revision 8c067cfd3aea0c49a166f9fb38114b56a9160ac6)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26PROG=		dns-sd finger rdate ruptime rwho whois
27SUIDPROG=	rcp rlogin rsh
28ALL=		$(PROG) $(SUIDPROG)
29SRCS=		$(ALL:%=%.c)
30KCMDPROGS=	rcp rlogin rsh
31
32SUBDIRS=	chat ftp nc nca netstat \
33		pppd pppdump pppstats rdist talk telnet tftp
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
74dns-sd :=	CFLAGS += $(C99_ENABLE)
75finger :=	CFLAGS += $(CCVERBOSE)
76# Enable large file support for reading the lastlog file.
77finger :=	CPPFLAGS += -D_FILE_OFFSET_BITS=64
78
79dns-sd :=		LDLIBS += -lsocket -ldns_sd
80finger :=		LDLIBS += -lnsl -lcurses -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 += -lsocket
86
87include  $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
88$(KCMDPROGS)	:=	LDLIBS += -lnsl -lmech_krb5
89$(KCMDPROGS)	:=	LDFLAGS += $(ZIGNORE) $(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