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