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