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