xref: /titanic_52/usr/src/cmd/rpcsvc/Makefile (revision b6c3f7863936abeae522e48a13887dddeb691a45)
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# cmd/rpcsvc/Makefile
28
29PROTOCOL_DIR= $(ROOT)/usr/include/rpcsvc
30
31BINPROG= rusers rup
32SBINPROG= rwall spray
33RPROG= rpc.rusersd
34SPROG= rpc.sprayd
35WPROG= rpc.rwalld
36TPROG= rpc.rstatd
37
38PROG= $(BINPROG) $(SBINPROG) $(RPROG) $(SPROG) $(WPROG) $(TPROG)
39
40MANIFEST= \
41	nisplus.xml \
42	rusers.xml \
43	spray.xml \
44	wall.xml \
45	rstat.xml
46
47SVCMETHOD= \
48	nisplus
49
50SCLNTOBJS= spray.o spray_clnt.o
51SSVCOBJS= spray_subr.o spray_svc.o
52WCLNTOBJS = rwall.o rwall_clnt.o
53WSVCOBJS= rwall_subr.o rwall_svc.o
54TSVCOBJS= rstat_main.o rstat_proc.o rstat_svc.o rstat_v2_svc.o rstat_v2_xdr.o
55
56DERIVED_FILES = rstat.x rstat.h rstat_svc.c rstat_v2.h rstat_v2_svc.c \
57		rstat_v2_xdr.c spray.x spray.h spray_clnt.c spray_svc.c \
58		rwall.x rwall.h rwall_svc.c rwall_clnt.c
59
60include ../Makefile.cmd
61
62ROOTMANIFESTDIR=	$(ROOTSVCNETWORKRPC)
63
64CPPFLAGS= -I. $(CPPFLAGS.master)
65LDLIBS += -lnsl
66rusers :=	CFLAGS += -v
67$(BINPROG) :=	LDLIBS += -lrpcsvc
68$(RPROG) :=	LDLIBS += -lrpcsvc
69$(SPROG) :=	LDLIBS += -lrpcsvc
70$(TPROG) :=	LDLIBS += -lrpcsvc
71spray :=	LDLIBS += -lrpcsvc
72
73CP=	cp
74
75SUBDIRS= rpc.bootparamd nis/utils nis/bin nis/cachemgr nis/rpc.nisd \
76	 nis/rpc.nispasswdd
77OBJS= $(SCLNTOBJS) $(SSVCOBJS) $(WCLNTOBJS) $(WSVCOBJS) $(TSVCOBJS)
78SRCS= $(OBJS:%.o=%.c) rusers.c rpc.rusersd.c rup.c
79
80ETCFILES= rpc
81
82TXTS= $(ETCFILES:%=net_files/%)
83
84NETSVC=	$(ROOTLIB)/netsvc
85NIS = $(NETSVC)/nis
86RWALL= $(NETSVC)/rwall
87RUSERS= $(NETSVC)/rusers
88SPRAY= $(NETSVC)/spray
89RSTAT= $(NETSVC)/rstat
90ROOTVAR_NIS= $(ROOT)/var/nis
91
92ROOTDIRS= \
93		$(NETSVC) \
94		$(NIS) \
95		$(RWALL) \
96		$(RUSERS) \
97		$(SPRAY) \
98		$(RSTAT) \
99		$(ROOTVAR_NIS)
100
101IBINPROG=		$(BINPROG:%=$(ROOTBIN)/%)
102ISBINPROG=		$(SBINPROG:%=$(ROOTUSRSBIN)/%)
103IWPROG=			$(WPROG:%=$(RWALL)/%)
104ISPROG=			$(SPROG:%=$(SPRAY)/%)
105IRPROG=			$(RPROG:%=$(RUSERS)/%)
106ITPROG=			$(TPROG:%=$(RSTAT)/%)
107IETCFILES=		$(ETCFILES:%=$(ROOTETC)/%)
108
109# non-default file attributes
110$(ROOTDIRS) :=					OWNER=		root
111$(ROOTDIRS) :=					GROUP=		sys
112
113$(ROOTETC)/rpc :=				FILEMODE=	0644
114$(ROOTETC)/rpc :=				OWNER=		root
115$(ROOTETC)/rpc :=				GROUP=		sys
116
117all:=		TARGET= all
118install:=	TARGET= install
119clean:=		TARGET= clean
120clobber:=	TARGET= clobber
121lint:=		TARGET= lint
122
123rpc.rstatd:=	LDLIBS += -lkstat
124rwall:=		CPPFLAGS += -D_REENTRANT
125rpc.rwalld:=	CPPFLAGS += -D_REENTRANT
126
127# install rules
128
129$(RWALL)/% $(SPRAY)/% $(RUSERS)/% $(RSTAT)/%: %
130	$(INS.file)
131
132$(ROOTETC)/%: ./net_files/%
133	$(INS.file)
134
135.KEEP_STATE:
136
137all: $(PROG) $(TXTS) $(SUBDIRS)
138
139# multi-object targets
140#
141spray:	$(SCLNTOBJS)
142	$(LINK.c) $(SCLNTOBJS) -o $@ $(LDLIBS)
143	$(POST_PROCESS)
144
145spray_svc.o spray_clnt.o: spray.h
146
147rpc.sprayd: $(SSVCOBJS)
148	$(LINK.c) $(SSVCOBJS) -o $@ $(LDLIBS)
149	$(POST_PROCESS)
150
151rwall_svc.o rwall_clnt.o: rwall.h
152
153rwall: $(WCLNTOBJS)
154	$(LINK.c) $(WCLNTOBJS) -o $@ $(LDLIBS)
155	$(POST_PROCESS)
156
157rpc.rwalld: $(WSVCOBJS)
158	$(LINK.c) $(WSVCOBJS) -o $@ $(LDLIBS)
159	$(POST_PROCESS)
160
161rstat_main.o:	rstat.h rstat_v2.h
162
163rstat_svc.o: rstat.h
164
165rstat_V2_svc.o rstat_V2_xdr.o: rstat_v2.h
166
167rpc.rstatd: $(TSVCOBJS)
168	$(LINK.c) $(TSVCOBJS) -o $@ $(LDLIBS)
169	$(POST_PROCESS)
170
171install: $(PROG) $(TXTS) .WAIT $(ROOTDIRS) .WAIT $(IBINPROG) $(ISBINPROG) \
172	$(IWPROG) $(ISPROG) $(IRPROG) $(ITPROG) $(IETCFILES) $(SUBDIRS) \
173	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
174
175$(ROOTDIRS):
176	$(INS.dir)
177
178$(SUBDIRS): FRC
179	@cd $@; pwd; $(MAKE) $(TARGET)
180
181#
182# Derived files
183#
184
185rstat.x: $(PROTOCOL_DIR)/rstat.x
186	$(RM) rstat.x
187	$(CP) $(PROTOCOL_DIR)/rstat.x rstat.x
188
189rstat.h: $(PROTOCOL_DIR)/rstat.h
190	$(RM) rstat.h
191	$(CP) $(PROTOCOL_DIR)/rstat.h rstat.h
192
193rstat_svc.c: rstat.x
194	$(RPCGEN) -C -m rstat.x > $@
195
196rstat_v2.h: rstat_v2.x
197	$(RPCGEN) -C -h rstat_v2.x > $@
198
199rstat_v2_svc.c: rstat_v2.x
200	$(RPCGEN) -C -m rstat_v2.x > $@
201
202rstat_v2_xdr.c: rstat_v2.x
203	$(RPCGEN) -c rstat_v2.x > $@
204
205spray.x: $(PROTOCOL_DIR)/spray.x
206	$(RM) spray.x
207	$(CP) $(PROTOCOL_DIR)/spray.x spray.x
208
209spray.h: $(PROTOCOL_DIR)/spray.h
210	$(RM) spray.h
211	$(CP) $(PROTOCOL_DIR)/spray.h spray.h
212
213spray_svc.c: spray.x
214	$(RPCGEN) -s datagram_v -s circuit_v spray.x > $@
215
216spray_clnt.c: spray.x
217	$(RPCGEN) -l spray.x > $@
218
219rwall.x: $(PROTOCOL_DIR)/rwall.x
220	$(RM) rwall.x
221	$(CP) $(PROTOCOL_DIR)/rwall.x rwall.x
222
223rwall.h: $(PROTOCOL_DIR)/rwall.h
224	$(RM) rwall.h
225	$(CP) $(PROTOCOL_DIR)/rwall.h rwall.h
226
227rwall_svc.c: rwall.x
228	$(RPCGEN) -A -s datagram_v rwall.x > $@
229
230rwall_clnt.c: rwall.x
231	$(RPCGEN) -l -M rwall.x > $@
232
233check:	$(CHKMANIFEST)
234
235clean: $(SUBDIRS)
236	-$(RM) $(OBJS) $(DERIVED_FILES)
237
238clobber: $(SUBDIRS)
239
240lint:
241	$(LINT.c) $(WCLNTOBJS:%.o=%.c) -lnsl -lrpcsvc
242	$(LINT.c) $(WSVCOBJS:%.o=%.c) -lnsl -lrpcsvc
243	$(LINT.c) rusers.c -lnsl -lrpcsvc
244
245FRC:
246
247include ../Makefile.targ
248