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