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