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