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