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