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