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