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 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 $(ROOTSUIDPROG) := OWNER= root 67 68 CPPFLAGS += -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 74 dns-sd := CFLAGS += $(C99_ENABLE) 75 finger := CFLAGS += $(CCVERBOSE) 76 # Enable large file support for reading the lastlog file. 77 finger := CPPFLAGS += -D_FILE_OFFSET_BITS=64 78 79 dns-sd := LDLIBS += -lsocket -ldns_sd 80 finger := LDLIBS += -lnsl -lcurses -lsocket 81 rcp lint-rcp := LDLIBS += -lsocket -lsec -lsendfile 82 rdate lint-rdate:= LDLIBS += -lsocket 83 rlogin lint-rlogin := LDLIBS += -lnsl -lsocket 84 rsh lint-rsh := LDLIBS += -lsocket 85 whois := LDLIBS += -lsocket 86 87 include $(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) 92 KCMDLINTS= $(KCMDPROGS:%=lint-%) 93 94 $(COMMONPOFILES) \ 95 rlogin.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 111 LINTXTRA= 112 $(KCMDLINTS) := LINTXTRA += $(COMMONSRCS) 113 114 ROOTSUNWRCP= $(ROOT)/usr/lib/sunw,rcp 115 ROOTRSHSYMLINK= $(ROOT)/usr/ucb/rsh 116 ROOTREMSHSYMLINK=$(ROOT)/usr/bin/remsh 117 118 .KEEP_STATE: 119 120 all: $(ALL) $(SUBDIRS) 121 122 install: 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 142 rlogin: rlogin.o $(COMMONOBJS) 143 $(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS) 144 $(POST_PROCESS) 145 146 rcp: rcp.o $(COMMONOBJS) 147 $(LINK.c) $@.o $(COMMONOBJS) -o $@ $(LDLIBS) 148 $(POST_PROCESS) 149 150 rsh: 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 166 FRC: 167 168 clean: $(SUBDIRS) 169 170 clobber: $(SUBDIRS) clobber_local 171 172 clobber_local: 173 echo $(CLOBBERFILES) 174 $(RM) $(ALL) $(CLOBBERFILES) 175 176 177 LINTLOCALS= $(LINTCLEAN:%.c=lint-%) 178 179 lint: $(LINTSUBDIRS) $(LINTLOCALS) 180 181 $(LINTLOCALS): 182 $(LINT.c) $(@:lint-%=%.c) $(LINTXTRA) $(LDLIBS) 183