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 26BINPROG = ypmatch ypwhich ypcat 27SBINPROG = makedbm ypalias ypinit yppoll ypset 28NETYPPROG = ypbind ypxfr yppush udpublickey mkalias \ 29 multi multi.awk stdethers stdhosts \ 30 ypxfr_1perday ypxfr_1perhour ypxfr_2perday \ 31 ypstart ypstop 32NIS2LDAPPROG = ypxfrd ypserv ypxfr 33SVCMETHOD = yp 34PROG= $(BINPROG) $(SBINPROG) $(NETYPPROG) $(NIS2LDAPPROG) $(SVCMETHOD) 35 36MANIFEST = server.xml client.xml xfr.xml 37 38include ../Makefile.cmd 39 40ROOTMANIFESTDIR = $(ROOTSVCNETWORKNIS) 41 42# installed directories 43NETSVC = $(ROOTLIB)/netsvc 44NETYP = $(NETSVC)/yp 45 46ROOTVAR_YP = $(ROOT)/var/yp 47ROOTBINDING = $(ROOTVAR_YP)/binding 48ROOTDIRS = $(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 55ypinit := LDLIBS += -lnsl 56yppoll := LDLIBS += -lnsl 57ypset := LDLIBS += -lnsl 58makedbm := MAPFILES = $(MAPFILE.INT) $(MAPFILE.NGB) 59makedbm := LDFLAGS += $(MAPFILES:%=-M%) 60 61$(ROOTVAR_YP)/aliases := FILEMODE=555 62 63YPFILES = Makefile aliases nicknames updaters 64ETCFILES = publickey 65ROOTYPFILES= $(YPFILES:%=$(ROOTVAR_YP)/%) 66ROOTETCFILE= $(ETCFILES:%=$(ROOTETC)/%) 67 68TXTS= $(ETCFILES:%=net_files/%) $(YPFILES:%=net_files/%) 69SUBDIRS = yppasswd mknetid revnetgroup ypupdated yp2lscripts 70 71YPBINDOBJ= 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# 76COMMONOBJ= getlist.o yp_getalias.o 77 78# 79# Objects shared between all the major components 80# 81SHARED_DIR= ./shared 82SHAREDOBJ= $(SHARED_DIR)/utils.o $(SHARED_DIR)/lockmap.o $(SHARED_DIR)/ancil.o 83SHARESRC = $(SHAREOBJ:.o=.c) 84 85YPXFROBJ = ypxfr.o ypxfrd_client.o ypxfrd_xdr.o 86YPMATOBJ = ypmatch.o nick.o 87YPWHIOBJ = ypwhich.o nick.o 88YPCATOBJ = ypcat.o nick.o 89UDPUBLICKEYOBJ = udpublickey.o 90MKALIASOBJ = mkalias.o 91STDETHERSOBJ = stdethers.o 92STDHOSTSOBJ = stdhosts.o 93#COMMONCLNTOBJ = clnt_create_rsvd.o 94YPSERVOBJ = 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 98YPPUSHOBJ = yppush.o 99YPXFRDOBJ = ypxfrd_svc.o ypxfrd_xdr.o ypxfrd_server.o \ 100 ypserv_net_secure.o 101 102NETYPOBJ = $(YPXFROBJ) $(YPXFRDOBJ) $(YPSERVOBJ) $(YPPUSHOBJ) \ 103 $(YPBINDOBJ) $(UDPUBLICKEYOBJ) 104OBJS = $(NETYPOBJ) $(MKALIASOBJ) $(COMMONOBJ) $(SHAREDOBJ) \ 105 $(YPPUSHOBJ) $(YPMATOBJ) $(YPWHIOBJ) $(YPCATOBJ) \ 106 $(STDETHERSOBJ) $(STDHOSTSOBJ) makedbm.o ypalias.o pong.o 107 108BINSRC = $(BINPROG:=.c) 109 110SBINSRC = $(SBINPROG:=.c) 111 112NETYPSRC = $(NETYPOBJ:.o=.c) 113 114YPBINDSRC = $(YPBINSOBJ:.o=.c) 115 116YPXFRSRC = $(YPXFROBJ:.o=.c) 117 118YPSERVSRC = $(YPSERVOBJ:.o=.c) 119 120YPPUSHSRC = $(YPPUSHOBJ:.o=.c) 121 122YPXFRDSRC = $(YPXFRDOBJ:.o=.c) 123 124YPMASTERSRC = $(YPMASTEROBJ:.o=.c) 125 126YPALLSRC = $(YPALLOBJ:.o=.c) 127 128COMMONSRC = $(COMMONOBJ:.o=.c) 129 130#COMMONCLNTSRC = $(COMMONCLNTOBJ:.o=.c) 131 132SRCS = $(BINSRC) $(SBINSRC) $(NETYPSRC) \ 133 $(COMMONSRC) $(SHAREDSRC) 134 135CLEANFILES = ypxfrd.h ypxfrd_xdr.c 136 137IBINPROG= $(BINPROG:%=$(ROOTBIN)/%) 138ISBINPROG= $(SBINPROG:%=$(ROOTUSRSBIN)/%) 139INETYPPROG= $(NETYPPROG:%=$(NETYP)/%) 140INIS2LDAPPROG = $(NIS2LDAPPROG:%=$(NETYP)/%) 141 142NIS2LDAPINC = -I$(SRC)/lib/libnisdb/yptol 143 144CERRWARN += -_gcc=-Wno-implicit-function-declaration 145CERRWARN += -_gcc=-Wno-parentheses 146CERRWARN += -_gcc=-Wno-unused-variable 147CERRWARN += -_gcc=-Wno-uninitialized 148CERRWARN += -_gcc=-Wno-switch 149CERRWARN += -_gcc=-Wno-extra 150CERRWARN += -_gcc=-Wno-unused-label 151CERRWARN += -_gcc=-Wno-address 152CERRWARN += -_gcc=-Wno-unused-function 153 154#conditional assignments 155ypalias.o := CPPFLAGS= -DMAIN $(CPPFLAGS.master) 156makedbm.o := CPPFLAGS= $(CPPFLAGS.master) 157yp_b_svc.o := CPPFLAGS += -DINIT_DEFAULT 158ypxfrd_svc.o := CPPFLAGS += -Dmain=_main 159ypxfr.o := CPPFLAGS += $(NIS2LDAPINC) 160yppush.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 168NETYP = $(NETSVC)/yp 169 170 171all:= TARGET= all 172install:= TARGET= install 173clean:= TARGET= clean 174clobber:= TARGET= clobber 175lint:= TARGET= lint 176cstyle := TARGET= cstyle 177 178all: $(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 196ypbind: $(YPBINDOBJ) 197 $(LINK.c) $(YPBINDOBJ) -o $@ $(LDLIBS) 198 $(POST_PROCESS) 199 200makedbm ypalias: $$@.o $(COMMONOBJ) $$(MAPFILES) 201 $(LINK.c) -o $@ $@.o $(COMMONOBJ) $(LDLIBS) 202 $(POST_PROCESS) 203 204ypmatch: $(YPMATOBJ) 205 $(LINK.c) -o $@ $(YPMATOBJ) $(LDLIBS) 206 $(POST_PROCESS) 207 208ypwhich: $(YPWHIOBJ) 209 $(LINK.c) -o $@ $(YPWHIOBJ) $(LDLIBS) 210 $(POST_PROCESS) 211 212ypcat: $(YPCATOBJ) 213 $(LINK.c) -o $@ $(YPCATOBJ) $(LDLIBS) 214 $(POST_PROCESS) 215 216ypxfrd_xdr.c: ypxfrd.x 217 $(RM) ypxfrd_xdr.c; $(RPCGEN) -C -c ypxfrd.x -o ypxfrd_xdr.c 218 219ypxfrd.h: ypxfrd.x 220 $(RM) ypxfrd.h; $(RPCGEN) -C -h ypxfrd.x -o ypxfrd.h 221 222ypxfrd_xdr.o ypxfrd_client.o: ypxfrd.h 223 224#clnt_create_rsvd.o ypxfr.o: clnt_create_rsvd.h 225 226ypxfrd: $(YPXFRDOBJ) $(SHAREDOBJ) 227 $(LINK.cc) $(YPXFRDOBJ) $(SHAREDOBJ) \ 228 -o $@ $(LDLIBS) -lc 229 $(POST_PROCESS) 230 231ypxfr: $(YPXFROBJ) $(COMMONOBJ) $(YPMASTEROBJ) $(SHAREDOBJ) 232 $(LINK.cc) -o $@ $(YPXFROBJ) $(YPMASTEROBJ) $(COMMONOBJ) \ 233 $(SHAREDOBJ) $(LDLIBS) 234 $(POST_PROCESS) 235 236ypserv: $(YPSERVOBJ) $(COMMONOBJ) $(SHAREDOBJ) 237 $(LINK.cc) $(YPSERVOBJ) $(COMMONOBJ) \ 238 $(SHAREDOBJ) -o $@ $(LDLIBS) 239 $(POST_PROCESS) 240 241yppush: $(YPPUSHOBJ) $(COMMONOBJ) 242 $(LINK.c) $(YPPUSHOBJ) $(COMMONOBJ) -o $@ $(LDLIBS) 243 $(POST_PROCESS) 244 245udpublickey: $(UDPUBLICKEYOBJ) 246 $(LINK.c) $(UDPUBLICKEYOBJ) -o $@ 247 $(POST_PROCESS) 248 249mkalias: $(MKALIASOBJ) 250 $(LINK.c) $(MKALIASOBJ) -o $@ -lnsl 251 $(POST_PROCESS) 252 253stdethers: $(STDETHERSOBJ) 254 $(LINK.c) $(STDETHERSOBJ) -o $@ -lsocket 255 $(POST_PROCESS) 256 257stdhosts: $(STDHOSTSOBJ) 258 $(LINK.c) $(STDHOSTSOBJ) -o $@ $(LDLIBS) 259 $(POST_PROCESS) 260 261install: 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 271lint := CPPFLAGS += -I$(SRC)/lib/libnisdb/yptol 272 273lint: $(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 297check: $(CHKMANIFEST) 298 299cstyle: $(SUBDIRS) 300 ${CSTYLE} `echo $(SRCS) | sed 's/ypinit.c//'` 301 302clean: $(SUBDIRS) 303 $(RM) $(OBJS) $(CLEANFILES) 304 305clobber: clean $(SUBDIRS) 306 307FRC: 308 309include ../Makefile.targ 310