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