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