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