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