xref: /titanic_41/usr/src/cmd/ypcmd/Makefile (revision 6a3e8e8695d5c7d1d18c6800d676990d7f61a2a4)
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
144#conditional assignments
145ypalias.o :=	CPPFLAGS= -DMAIN $(CPPFLAGS.master)
146makedbm.o :=	CPPFLAGS= $(CPPFLAGS.master)
147yp_b_svc.o :=	CPPFLAGS += -DINIT_DEFAULT
148ypxfrd_svc.o := CPPFLAGS += -Dmain=_main
149ypxfr.o := CPPFLAGS += $(NIS2LDAPINC)
150yppush.o := CPPFLAGS += $(NIS2LDAPINC)
151$(NIS2LDAPPROG) := CPPFLAGS += $(NIS2LDAPINC)
152$(SHAREDOBJ) := CPPFLAGS += -I$(SRC)/lib/libnisdb/yptol
153$(ROOTVAR_YP)/Makefile := FILEMODE= 555
154$(ROOTVAR_YP)/nicknames := FILEMODE= 644
155$(ROOTVAR_YP)/updaters := FILEMODE= 500
156$(ROOTETC)/publickey := FILEMODE= 644
157# non-default file attributes to avoid conflict with rpcsrc
158NETYP =		$(NETSVC)/yp
159
160
161all:=		TARGET= all
162install:=	TARGET= install
163clean:=		TARGET= clean
164clobber:=	TARGET= clobber
165lint:=		TARGET= lint
166cstyle :=	TARGET= cstyle
167
168all: $(SHAREDOBJ) $(SUBDIRS) $(PROG) $(TXTS)
169
170# install rules
171$(ROOTVAR_YP)/% \
172$(ROOTETC)/%: net_files/%
173	$(INS.file)
174
175$(ROOTVAR_YP)/% : net_files/%
176	$(INS.file)
177
178$(NETYP)/%: %
179	$(INS.file)
180
181.KEEP_STATE:
182
183$(SHAREDOBJ): $(SHAREDSRC)
184	$(COMPILE.c) $(SHAREDSRC) -o $@ $<
185
186ypbind: $(YPBINDOBJ)
187	$(LINK.c) $(YPBINDOBJ) -o $@ $(LDLIBS)
188	$(POST_PROCESS)
189
190makedbm ypalias: $$@.o $(COMMONOBJ) $$(MAPFILES)
191	$(LINK.c) -o $@ $@.o $(COMMONOBJ) $(LDLIBS)
192	$(POST_PROCESS)
193
194ypmatch: $(YPMATOBJ)
195	$(LINK.c) -o $@ $(YPMATOBJ) $(LDLIBS)
196	$(POST_PROCESS)
197
198ypwhich: $(YPWHIOBJ)
199	$(LINK.c) -o $@ $(YPWHIOBJ) $(LDLIBS)
200	$(POST_PROCESS)
201
202ypcat: $(YPCATOBJ)
203	$(LINK.c) -o $@ $(YPCATOBJ) $(LDLIBS)
204	$(POST_PROCESS)
205
206ypxfrd_xdr.c: ypxfrd.x
207	$(RM) ypxfrd_xdr.c; $(RPCGEN) -C -c ypxfrd.x -o ypxfrd_xdr.c
208
209ypxfrd.h: ypxfrd.x
210	$(RM) ypxfrd.h; $(RPCGEN) -C -h ypxfrd.x -o ypxfrd.h
211
212ypxfrd_xdr.o ypxfrd_client.o: ypxfrd.h
213
214#clnt_create_rsvd.o ypxfr.o: clnt_create_rsvd.h
215
216ypxfrd: $(YPXFRDOBJ) $(SHAREDOBJ)
217	$(LINK.cc) $(YPXFRDOBJ) $(SHAREDOBJ) \
218	-o $@ $(LDLIBS) -lc
219	$(POST_PROCESS)
220
221ypxfr: $(YPXFROBJ) $(COMMONOBJ) $(YPMASTEROBJ) $(SHAREDOBJ)
222	$(LINK.cc) -o $@ $(YPXFROBJ) $(YPMASTEROBJ) $(COMMONOBJ) \
223		$(SHAREDOBJ) $(LDLIBS)
224	$(POST_PROCESS)
225
226ypserv: $(YPSERVOBJ) $(COMMONOBJ) $(SHAREDOBJ)
227	$(LINK.cc) $(YPSERVOBJ) $(COMMONOBJ) \
228		$(SHAREDOBJ) -o $@ $(LDLIBS)
229	$(POST_PROCESS)
230
231yppush: $(YPPUSHOBJ) $(COMMONOBJ)
232	$(LINK.c) $(YPPUSHOBJ) $(COMMONOBJ) -o $@ $(LDLIBS)
233	$(POST_PROCESS)
234
235udpublickey: $(UDPUBLICKEYOBJ)
236	$(LINK.c) $(UDPUBLICKEYOBJ) -o $@
237	$(POST_PROCESS)
238
239mkalias: $(MKALIASOBJ)
240	$(LINK.c) $(MKALIASOBJ) -o $@ -lnsl
241	$(POST_PROCESS)
242
243stdethers: $(STDETHERSOBJ)
244	$(LINK.c) $(STDETHERSOBJ) -o $@ -lsocket
245	$(POST_PROCESS)
246
247stdhosts: $(STDHOSTSOBJ)
248	$(LINK.c) $(STDHOSTSOBJ) -o $@ $(LDLIBS)
249	$(POST_PROCESS)
250
251install: all $(PROG) $(ROOTDIRS) $(ROOTETCFILE) $(ROOTYPFILES) $(IBINPROG) \
252	$(ISBINPROG) $(INETYPPROG) $(INIS2LDAPPROG) $(SUBDIRS) $(ROOTMANIFEST) \
253	$(ROOTSVCMETHOD)
254
255$(ROOTDIRS):
256	$(INS.dir)
257
258$(SUBDIRS): FRC
259	@cd $@; pwd; $(MAKE) $(TARGET)
260
261lint := CPPFLAGS += -I$(SRC)/lib/libnisdb/yptol
262
263lint:	$(SUBDIRS)
264	$(LINT.c) ypmatch.c nick.c -lnsl
265	$(LINT.c) ypwhich.c nick.c -lnsl
266	$(LINT.c) ypcat.c nick.c -lnsl
267	$(LINT.c) makedbm.c getlist.c yp_getalias.c
268	$(LINT.c) ypalias.c getlist.c yp_getalias.c
269	$(LINT.c) yp_b_svc.c yp_b_subr.c rpc_bootstrap.c getlist.c -lnsl
270	$(LINT.c) ypxfr.c ypxfrd_client.c ypxfrd_xdr.c getlist.c yp_getalias.c \
271		./shared/utils.c ./shared/lockmap.c ./shared/ancil.c -lnsl
272	$(LINT.c) yppush.c getlist.c yp_getalias.c -lnsl
273	$(LINT.c) udpublickey.c
274	$(LINT.c) mkalias.c -lnsl
275	$(LINT.c) stdethers.c -lsocket
276	$(LINT.c) stdhosts.c -lnsl
277	$(LINT.c) ypxfrd_svc.c ypxfrd_xdr.c ypxfrd_server.c \
278		ypserv_net_secure.c \
279		./shared/utils.c ./shared/lockmap.c ./shared/ancil.c \
280		-lnsl -lnisdb
281	$(LINT.c) ypserv.c ypserv_map.c ypserv_proc.c ypserv_ancil.c \
282		ypserv_resolv.c ypserv_resolv_common.c ypv1_xdr.c \
283		ypserv_net_secure.c getlist.c yp_getalias.c \
284		./shared/utils.c ./shared/lockmap.c ./shared/ancil.c \
285		-lnsl -lnisdb
286
287check: $(CHKMANIFEST)
288
289cstyle:	$(SUBDIRS)
290	${CSTYLE} `echo $(SRCS) | sed 's/ypinit.c//'`
291
292clean:	$(SUBDIRS)
293	$(RM) $(OBJS) $(CLEANFILES)
294
295clobber: clean $(SUBDIRS)
296
297FRC:
298
299include ../Makefile.targ
300