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