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 # Copyright 2015 Gary Mills
  23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 # Copyright 2020 Joyent, Inc.
  26 #
  27 
  28 BINPROG = ypmatch ypwhich ypcat
  29 SBINPROG = makedbm ypalias ypinit yppoll ypset
  30 NETYPPROG = ypbind ypxfr yppush udpublickey mkalias \
  31                 multi multi.awk stdethers stdhosts \
  32                 ypxfr_1perday ypxfr_1perhour ypxfr_2perday \
  33                 ypstart ypstop
  34 NIS2LDAPPROG = ypxfrd ypserv ypxfr
  35 SVCMETHOD = yp
  36 PROG=   $(BINPROG) $(SBINPROG) $(NETYPPROG) $(NIS2LDAPPROG) $(SVCMETHOD)
  37 
  38 MANIFEST = server.xml client.xml xfr.xml
  39 
  40 # These only need -lnsl
  41 LNSLPROG = ypmatch ypwhich ypcat yppoll ypset \
  42         ypbind ypxfr yppush mkalias stdhosts
  43 
  44 include ../Makefile.cmd
  45 
  46 ROOTMANIFESTDIR = $(ROOTSVCNETWORKNIS)
  47 
  48 # installed directories
  49 NETSVC = $(ROOTLIB)/netsvc
  50 NETYP = $(NETSVC)/yp
  51 
  52 ROOTVAR_YP = $(ROOT)/var/yp
  53 ROOTBINDING = $(ROOTVAR_YP)/binding
  54 ROOTDIRS =      $(ROOT) $(ROOTUSR) $(ROOTLIB) $(ROOTETC) $(ROOTVAR) \
  55                 $(NETSVC) $(NETYP) $(ROOTVAR_YP) $(ROOTBINDING) \
  56                 $(ROOTUSRSBIN) $(ROOTBIN)
  57 
  58 $(LNSLPROG) :=  LDLIBS += -lnsl
  59 $(NIS2LDAPPROG) := LDLIBS += -lc -lnsl -lnisdb
  60 stdethers :=    LDLIBS += -lsocket
  61 makedbm :=      MAPFILES = $(MAPFILE.INT) $(MAPFILE.NGB)
  62 makedbm :=      LDFLAGS += $(MAPFILES:%=-M%)
  63 
  64 $(ROOTVAR_YP)/aliases :=        FILEMODE=555
  65 
  66 YPFILES = Makefile aliases nicknames updaters
  67 ETCFILES =  publickey
  68 ROOTYPFILES= $(YPFILES:%=$(ROOTVAR_YP)/%)
  69 ROOTETCFILE= $(ETCFILES:%=$(ROOTETC)/%)
  70 
  71 TXTS=   $(ETCFILES:%=net_files/%) $(YPFILES:%=net_files/%)
  72 SUBDIRS = yppasswd mknetid revnetgroup ypupdated yp2lscripts
  73 
  74 YPBINDOBJ= yp_b_svc.o yp_b_subr.o rpc_bootstrap.o getlist.o
  75 #
  76 # Some sort of obsolete idea of common files which are only now used by a 
  77 # few minor utilities
  78 #
  79 COMMONOBJ= getlist.o yp_getalias.o 
  80 
  81 #
  82 # Objects shared between all the major components
  83 #
  84 SHARED_DIR= ./shared
  85 SHAREDOBJ= $(SHARED_DIR)/utils.o $(SHARED_DIR)/lockmap.o $(SHARED_DIR)/ancil.o
  86 SHARESRC = $(SHAREOBJ:.o=.c)
  87 
  88 YPXFROBJ = ypxfr.o ypxfrd_client.o ypxfrd_xdr.o
  89 YPMATOBJ = ypmatch.o nick.o
  90 YPWHIOBJ = ypwhich.o nick.o
  91 YPCATOBJ = ypcat.o nick.o
  92 UDPUBLICKEYOBJ = udpublickey.o
  93 MKALIASOBJ = mkalias.o
  94 STDETHERSOBJ = stdethers.o
  95 STDHOSTSOBJ = stdhosts.o
  96 #COMMONCLNTOBJ =        clnt_create_rsvd.o
  97 YPSERVOBJ = ypserv.o ypserv_map.o \
  98                 ypserv_proc.o ypserv_ancil.o \
  99                 ypserv_resolv.o ypserv_resolv_common.o \
 100                 ypv1_xdr.o ypserv_net_secure.o
 101 YPPUSHOBJ = yppush.o
 102 YPXFRDOBJ = ypxfrd_svc.o ypxfrd_xdr.o ypxfrd_server.o \
 103                 ypserv_net_secure.o
 104 
 105 NETYPOBJ = $(YPXFROBJ) $(YPXFRDOBJ) $(YPSERVOBJ) $(YPPUSHOBJ) \
 106                 $(YPBINDOBJ) $(UDPUBLICKEYOBJ)
 107 OBJS = $(NETYPOBJ) $(MKALIASOBJ) $(COMMONOBJ) $(SHAREDOBJ) \
 108         $(YPPUSHOBJ) $(YPMATOBJ) $(YPWHIOBJ) $(YPCATOBJ) \
 109         $(STDETHERSOBJ) $(STDHOSTSOBJ) makedbm.o ypalias.o pong.o
 110 
 111 BINSRC = $(BINPROG:=.c)
 112 
 113 SBINSRC = $(SBINPROG:=.c)
 114 
 115 NETYPSRC = $(NETYPOBJ:.o=.c)
 116 
 117 YPBINDSRC = $(YPBINSOBJ:.o=.c)
 118 
 119 YPXFRSRC =      $(YPXFROBJ:.o=.c)
 120 
 121 YPSERVSRC =     $(YPSERVOBJ:.o=.c)
 122 
 123 YPPUSHSRC =     $(YPPUSHOBJ:.o=.c)
 124 
 125 YPXFRDSRC =     $(YPXFRDOBJ:.o=.c)
 126 
 127 YPMASTERSRC =   $(YPMASTEROBJ:.o=.c)
 128 
 129 YPALLSRC =      $(YPALLOBJ:.o=.c)
 130 
 131 COMMONSRC =     $(COMMONOBJ:.o=.c)
 132 
 133 #COMMONCLNTSRC =        $(COMMONCLNTOBJ:.o=.c)
 134 
 135 SRCS = $(BINSRC) $(SBINSRC) $(NETYPSRC) \
 136         $(COMMONSRC) $(SHAREDSRC)
 137 
 138 CLEANFILES =    ypxfrd.h ypxfrd_xdr.c 
 139 
 140 IBINPROG=               $(BINPROG:%=$(ROOTBIN)/%)
 141 ISBINPROG=              $(SBINPROG:%=$(ROOTUSRSBIN)/%)
 142 INETYPPROG=             $(NETYPPROG:%=$(NETYP)/%)
 143 INIS2LDAPPROG =         $(NIS2LDAPPROG:%=$(NETYP)/%)
 144 
 145 NIS2LDAPINC =           -I$(SRC)/lib/libnisdb/yptol
 146 
 147 CERRWARN +=     -_gcc=-Wno-implicit-function-declaration
 148 CERRWARN +=     -_gcc=-Wno-parentheses
 149 CERRWARN +=     -_gcc=-Wno-unused-variable
 150 CERRWARN +=     $(CNOWARN_UNINIT)
 151 CERRWARN +=     -_gcc=-Wno-switch
 152 CERRWARN +=     -_gcc=-Wno-extra
 153 CERRWARN +=     -_gcc=-Wno-unused-label
 154 CERRWARN +=     -_gcc=-Wno-address
 155 CERRWARN +=     -_gcc=-Wno-unused-function
 156 
 157 # too many unknown types
 158 SMATCH =        off
 159 
 160 ZGUIDANCE = -zguidance=nounused
 161 
 162 #conditional assignments
 163 ypalias.o :=    CPPFLAGS= -DMAIN $(CPPFLAGS.master)
 164 makedbm.o :=    CPPFLAGS= $(CPPFLAGS.master)
 165 yp_b_svc.o :=   CPPFLAGS += -DINIT_DEFAULT
 166 ypxfrd_svc.o := CPPFLAGS += -Dmain=_main
 167 ypxfr.o := CPPFLAGS += $(NIS2LDAPINC)
 168 yppush.o := CPPFLAGS += $(NIS2LDAPINC)
 169 $(NIS2LDAPPROG) := CPPFLAGS += $(NIS2LDAPINC)
 170 $(SHAREDOBJ) := CPPFLAGS += -I$(SRC)/lib/libnisdb/yptol
 171 $(ROOTVAR_YP)/Makefile := FILEMODE= 555
 172 $(ROOTVAR_YP)/nicknames := FILEMODE= 644
 173 $(ROOTVAR_YP)/updaters := FILEMODE= 500
 174 $(ROOTETC)/publickey := FILEMODE= 644
 175 # non-default file attributes to avoid conflict with rpcsrc
 176 NETYP =         $(NETSVC)/yp
 177 
 178 
 179 all:=           TARGET= all
 180 install:=       TARGET= install
 181 clean:=         TARGET= clean
 182 clobber:=       TARGET= clobber
 183 cstyle :=       TARGET= cstyle
 184 
 185 all: $(SHAREDOBJ) $(SUBDIRS) $(PROG) $(TXTS) 
 186 
 187 # install rules
 188 $(ROOTVAR_YP)/% \
 189 $(ROOTETC)/%: net_files/%
 190         $(INS.file)
 191 
 192 $(ROOTVAR_YP)/% : net_files/%
 193         $(INS.file)
 194 
 195 $(NETYP)/%: %
 196         $(INS.file)
 197 
 198 .KEEP_STATE:
 199 
 200 $(SHAREDOBJ): $(SHAREDSRC)
 201         $(COMPILE.c) $(SHAREDSRC) -o $@ $<
 202 
 203 ypbind: $(YPBINDOBJ)
 204         $(LINK.c) $(YPBINDOBJ) -o $@ $(LDLIBS)
 205         $(POST_PROCESS)
 206 
 207 makedbm ypalias: $$@.o $(COMMONOBJ) $$(MAPFILES)
 208         $(LINK.c) -o $@ $@.o $(COMMONOBJ) $(LDLIBS)
 209         $(POST_PROCESS)
 210 
 211 ypmatch: $(YPMATOBJ)
 212         $(LINK.c) -o $@ $(YPMATOBJ) $(LDLIBS)
 213         $(POST_PROCESS)
 214 
 215 ypwhich: $(YPWHIOBJ)
 216         $(LINK.c) -o $@ $(YPWHIOBJ) $(LDLIBS)
 217         $(POST_PROCESS)
 218 
 219 ypcat: $(YPCATOBJ)
 220         $(LINK.c) -o $@ $(YPCATOBJ) $(LDLIBS)
 221         $(POST_PROCESS)
 222 
 223 ypxfrd_xdr.c: ypxfrd.x
 224         $(RM) ypxfrd_xdr.c; $(RPCGEN) -C -c ypxfrd.x -o ypxfrd_xdr.c
 225 
 226 ypxfrd.h: ypxfrd.x
 227         $(RM) ypxfrd.h; $(RPCGEN) -C -h ypxfrd.x -o ypxfrd.h
 228 
 229 ypxfrd_xdr.o ypxfrd_client.o: ypxfrd.h
 230 
 231 #clnt_create_rsvd.o ypxfr.o: clnt_create_rsvd.h
 232 
 233 ypxfrd: $(YPXFRDOBJ) $(SHAREDOBJ)
 234         $(LINK.cc) $(YPXFRDOBJ) $(SHAREDOBJ) \
 235         -o $@ $(LDLIBS) -lc
 236         $(POST_PROCESS)
 237 
 238 ypxfr: $(YPXFROBJ) $(COMMONOBJ) $(YPMASTEROBJ) $(SHAREDOBJ)
 239         $(LINK.cc) -o $@ $(YPXFROBJ) $(YPMASTEROBJ) $(COMMONOBJ) \
 240                 $(SHAREDOBJ) $(LDLIBS)
 241         $(POST_PROCESS)
 242 
 243 ypserv: $(YPSERVOBJ) $(COMMONOBJ) $(SHAREDOBJ)
 244         $(LINK.cc) $(YPSERVOBJ) $(COMMONOBJ) \
 245                 $(SHAREDOBJ) -o $@ $(LDLIBS)
 246         $(POST_PROCESS)
 247 
 248 yppush: $(YPPUSHOBJ) $(COMMONOBJ)
 249         $(LINK.c) $(YPPUSHOBJ) $(COMMONOBJ) -o $@ $(LDLIBS)
 250         $(POST_PROCESS)
 251 
 252 udpublickey: $(UDPUBLICKEYOBJ)
 253         $(LINK.c) $(UDPUBLICKEYOBJ) -o $@ $(LDLIBS)
 254         $(POST_PROCESS)
 255 
 256 mkalias: $(MKALIASOBJ)
 257         $(LINK.c) $(MKALIASOBJ) -o $@ $(LDLIBS)
 258         $(POST_PROCESS)
 259 
 260 stdethers: $(STDETHERSOBJ)
 261         $(LINK.c) $(STDETHERSOBJ) -o $@ $(LDLIBS)
 262         $(POST_PROCESS)
 263 
 264 stdhosts: $(STDHOSTSOBJ)
 265         $(LINK.c) $(STDHOSTSOBJ) -o $@ $(LDLIBS)
 266         $(POST_PROCESS)
 267 
 268 install: all $(PROG) $(ROOTDIRS) $(ROOTETCFILE) $(ROOTYPFILES) $(IBINPROG) \
 269         $(ISBINPROG) $(INETYPPROG) $(INIS2LDAPPROG) $(SUBDIRS) $(ROOTMANIFEST) \
 270         $(ROOTSVCMETHOD)
 271 
 272 $(ROOTDIRS):
 273         $(INS.dir)
 274 
 275 $(SUBDIRS): FRC
 276         @cd $@; pwd; $(MAKE) $(TARGET)
 277 
 278 check: $(CHKMANIFEST)
 279 
 280 cstyle: $(SUBDIRS)
 281         ${CSTYLE} `echo $(SRCS) | sed 's/ypinit.c//'`
 282 
 283 clean:  $(SUBDIRS)
 284         $(RM) $(OBJS) $(CLEANFILES)
 285 
 286 clobber: clean $(SUBDIRS)
 287 
 288 FRC:
 289 
 290 include ../Makefile.targ