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