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 #
  23 # Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  24 #
  25 
  26 SYNCPROG=       syncinit syncloop syncstat
  27 
  28 PROG=           6to4relay arp gettable if_mpadm \
  29                 in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
  30                 in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
  31                 ndd $(SYNCPROG) wanbootutil
  32 
  33 MANIFEST=       rarp.xml telnet.xml comsat.xml finger.xml \
  34                 login.xml shell.xml rexec.xml socket-filter-kssl.xml
  35 SVCMETHOD=      svc-sockfilter
  36 
  37 ROOTFS_PROG=    hostconfig route soconfig
  38 SBINLINKS=      hostconfig route
  39 
  40 RPCSVCPROG=     hostconfig
  41 AUDITPROG=      in.rexecd in.rlogind in.rshd in.telnetd
  42 PAMPROG=        in.rexecd in.rlogind in.rshd in.telnetd
  43 SOCKETPROG=     6to4relay arp gettable hostconfig if_mpadm in.comsat \
  44                 in.fingerd in.rarpd in.rexecd in.rlogind in.rshd \
  45                 in.rwhod in.telnetd in.tftpd ipaddrsel route
  46 NSLPROG=        6to4relay arp gettable hostconfig in.comsat in.rarpd \
  47                 in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
  48                 in.tftpd ipaddrsel route
  49 CMDPROG=        in.telnetd
  50 K5PROGS=        in.telnetd in.rlogind in.rshd
  51 TSNETPROG=      route
  52 DLADMPROG=      6to4relay
  53 DEFAULTFILES=   telnetd.dfl
  54 
  55 PROGSRCS=       $(PROG:%=%.c)
  56 TFTPDOBJS=      in.tftpd.o tftpsubs.o
  57 OTHERSRC=       ../usr.bin/tftp/tftpsubs.c
  58 K5RLOGINOBJS=   in.rlogind.o
  59 K5RSHDOBJS=     in.rshd.o
  60 K5TELNETOBJS=   in.telnetd.o
  61 SRCS=           $(PROGSRCS) $(OTHERSRC)
  62 
  63 SUBDIRS=        bootconfchk htable ifconfig ilbadm in.rdisc in.routed \
  64                 in.talkd inetadm inetconv ipadm ipmpstat ipqosconf ipsecutils \
  65                 kssl/kssladm kssl/ksslcfg nwamadm nwamcfg ping routeadm \
  66                 snoop sppptun traceroute wificonfig
  67 
  68 MSGSUBDIRS=     bootconfchk htable ifconfig ilbadm in.routed in.talkd \
  69                 inetadm inetconv ipadm ipmpstat ipqosconf ipsecutils \
  70                 kssl/ksslcfg nwamadm nwamcfg routeadm sppptun snoop wificonfig
  71 
  72 # As programs get lint-clean, add them here and to the 'lint' target.
  73 # Eventually this hack should go away, and all in PROG should be
  74 # lint-clean.
  75 LINTCLEAN=      6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
  76                 ipaddrsel route \
  77                 in.rarpd if_mpadm $(SYNCPROG)
  78 # Likewise, as subdirs get lint-clean, add them here.  Once
  79 # they're all clean, replace the dependency of the lint target
  80 # with SUBDIRS.  Also (sigh) deal with the commented-out build lines
  81 # for the lint rule.
  82 LINTSUBDIRS=    bootconfchk ilbadm in.rdisc in.routed in.talkd inetadm \
  83                 inetconv ipmpstat ipqosconf ipsecutils kssl/kssladm \
  84                 kssl/ksslcfg nwamadm nwamcfg ping routeadm sppptun traceroute \
  85                 wificonfig
  86 # And as programs are verified not to attempt to write into constants,
  87 # -xstrconst should be used to ensure they stay that way.
  88 CONSTCLEAN=
  89 
  90 include ../../Makefile.cmd
  91 ROOTMANIFESTDIR=        $(ROOTSVCNETWORK)
  92 $(ROOTMANIFEST)         := FILEMODE= 444
  93 include ../Makefile.cmd-inet
  94 
  95 ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
  96 ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
  97 
  98 COMMONOBJS=     addr_match.o kcmd.o store_forw_creds.o
  99 COMMONSRCS=     $(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
 100 SRCS+=          $(COMMONSRCS)
 101 
 102 CERRWARN += -_gcc=-Wno-implicit-function-declaration
 103 CERRWARN += -_gcc=-Wno-uninitialized
 104 CERRWARN += -_gcc=-Wno-unused-variable
 105 CERRWARN += -_gcc=-Wno-unused-function
 106 CERRWARN += -_gcc=-Wno-parentheses
 107 CERRWARN += -_gcc=-Wno-char-subscripts
 108 CERRWARN += -_gcc=-Wno-extra
 109 CERRWARN += -_gcc=-Wno-address
 110 
 111 #
 112 # Message catalog
 113 #
 114 POFILES=        6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po \
 115                 soconfig.po
 116 POFILE=         usr.sbin.po
 117 
 118 all:=           TARGET= all
 119 install:=       TARGET= install
 120 clean:=         TARGET= clean
 121 clobber:=       TARGET= clobber
 122 lint:=          TARGET= lint
 123 _msg:=          TARGET= _msg
 124 
 125 CLOBBERFILES += $(ROOTFS_PROG) $(PROG)
 126 CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS) \
 127                 $(K5TELNETOBJS)
 128 
 129 CPPFLAGS +=     -DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
 130 
 131 include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
 132 K5LIBS=
 133 
 134 # Eventually just plain CFLAGS should be += -v, but not until all in
 135 # PROGS are lint clean.
 136 $(LINTCLEAN)            :=      CFLAGS += $(CCVERBOSE)
 137 $(CONSTCLEAN)           :=      CFLAGS += $(XSTRCONST)
 138 
 139 $(SYNCPROG)             :=      LDLIBS += -ldlpi
 140 $(SOCKETPROG)           :=      LDLIBS += -lsocket
 141 $(NSLPROG)              :=      LDLIBS += -lnsl
 142 $(AUDITPROG)            :=      LDLIBS += -lbsm
 143 $(PAMPROG)              :=      LDLIBS += -lpam
 144 $(RPCSVCPROG)           :=      LDLIBS += -lrpcsvc
 145 $(K5PROGS)              :=      LDFLAGS += $(KRUNPATH) \
 146                                 -L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
 147 $(K5PROGS)              :=      K5LIBS=  -lmech_krb5
 148 $(K5PROGS)              :=      CPPFLAGS += -I$(SRC)/head \
 149                                 -I$(SRC)/uts/common/ \
 150                                 -I$(SRC)/uts/common/gssapi/mechs/krb5/include \
 151                                 -I$(SRC)/lib/gss_mechs/mech_krb5/include \
 152                                 -I$(SRC)/lib/pam_modules/krb5
 153 LDLIBS +=       $(K5LIBS)
 154 $(TSNETPROG)            :=      LDLIBS += -ltsnet
 155 $(DLADMPROG)            :=      LDLIBS += -ldladm
 156 
 157 in.rarpd                :=      LDLIBS += -linetutil -ldlpi
 158 if_mpadm                :=      LDLIBS += -linetutil -lipmp
 159 if_mpadm.po             :=      XGETFLAGS += -a
 160 route                   :=      CPPFLAGS += -DNDEBUG
 161 ndd                     :=      LDLIBS += -ldladm -lipadm
 162 gettable in.comsat      :=      LDFLAGS += $(MAPFILE.NGB:%=-M%)
 163 
 164 .KEEP_STATE:
 165 
 166 .PARALLEL:
 167 
 168 all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
 169 
 170 #
 171 # message catalog
 172 #
 173 _msg: $(MSGSUBDIRS) $(POFILE)
 174 
 175 syncutil: $(SYNCPROG)
 176 
 177 $(POFILE): $(POFILES)
 178         $(RM) $@
 179         cat $(POFILES) > $@
 180 
 181 %.o: $(CMDINETCOMMONDIR)/%.c
 182         $(COMPILE.c) -o $@ $<
 183 
 184 in.telnetd: $(K5TELNETOBJS)
 185         $(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
 186         $(POST_PROCESS)
 187 
 188 in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
 189         $(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
 190         $(POST_PROCESS)
 191 
 192 in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
 193         $(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
 194         $(POST_PROCESS)
 195 
 196 in.tftpd: $(TFTPDOBJS)
 197         $(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
 198         $(POST_PROCESS)
 199 
 200 tftpsubs.o: $(OTHERSRC)
 201         $(COMPILE.c) $(OTHERSRC) -o $@
 202         $(POST_PROCESS_O)
 203 
 204 $(ROOTUSRSBINLINKS):
 205         -$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
 206 
 207 install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
 208         $(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
 209         $(ROOTMANIFEST) $(ROOTSVCMETHOD) THIRDPARTYLICENSE.arp
 210 
 211 THIRDPARTYLICENSE.arp: arp.c
 212         $(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
 213 
 214 CLOBBERFILES += THIRDPARTYLICENSE.arp
 215 
 216 #
 217 # The reason this rule checks for the existence of the
 218 # Makefile is that some of the directories do not exist
 219 # in our exportable source builds.
 220 #
 221 $(SUBDIRS): FRC
 222         @if [ -f $@/Makefile  ]; then \
 223                 cd $@; pwd; $(MAKE) $(TARGET); \
 224         else \
 225                 true; \
 226         fi
 227 
 228 FRC:
 229 
 230 check:  $(CHKMANIFEST)
 231 
 232 clean: $(SUBDIRS) clean_local
 233 clean_local:
 234         $(RM) $(CLEANFILES)
 235 
 236 clobber: $(SUBDIRS) clobber_local
 237 clobber_local: clean_local
 238         $(RM) $(CLOBBERFILES)
 239 
 240 lint: $(LINTSUBDIRS)
 241         $(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -ldladm
 242         $(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
 243         @# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
 244         $(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
 245                 -I$(SRC)/head -I$(SRC)/uts/common/ \
 246                 -I$(SRC)/uts/common/gssapi/mechs/krb5/include \
 247                 -I$(SRC)/lib/gss_mechs/mech_krb5/include \
 248                 -I$(SRC)/lib/pam_modules/krb5 \
 249                 in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
 250         $(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
 251                 -I$(SRC)/head -I$(SRC)/uts/common/ \
 252                 -I$(SRC)/uts/common/gssapi/mechs/krb5/include \
 253                 -I$(SRC)/lib/gss_mechs/mech_krb5/include \
 254                 -I$(SRC)/lib/pam_modules/krb5 \
 255                 in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
 256         $(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
 257                 -erroff=E_GLOBAL_COULD_BE_STATIC2 \
 258                 -I$(SRC)/head -I$(SRC)/uts/common/ \
 259                 -I$(SRC)/uts/common/gssapi/mechs/krb5/include \
 260                 -I$(SRC)/lib/gss_mechs/mech_krb5/include \
 261                 -I$(SRC)/lib/pam_modules/krb5 \
 262                 in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
 263         $(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
 264         $(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
 265         $(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
 266         $(LINT.c) syncinit.c $(LDLIBS) -ldlpi
 267         $(LINT.c) syncloop.c $(LDLIBS) -ldlpi
 268         $(LINT.c) syncstat.c $(LDLIBS) -ldlpi
 269         $(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
 270             -lsocket -lnsl
 271         $(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
 272             -lsocket -lnsl