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