xref: /titanic_44/usr/src/cmd/rpcsvc/Makefile (revision 8de5c4f463386063e184a851437d58080c6c626c)
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#
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$(ROOTETC)/rpc :=				FILEMODE=	0644
109
110all:=		TARGET= all
111install:=	TARGET= install
112clean:=		TARGET= clean
113clobber:=	TARGET= clobber
114lint:=		TARGET= lint
115
116rpc.rstatd:=	LDLIBS += -lkstat
117rwall:=		CPPFLAGS += -D_REENTRANT
118rpc.rwalld:=	CPPFLAGS += -D_REENTRANT
119
120# install rules
121
122$(RWALL)/% $(SPRAY)/% $(RUSERS)/% $(RSTAT)/%: %
123	$(INS.file)
124
125$(ROOTETC)/%: ./net_files/%
126	$(INS.file)
127
128.KEEP_STATE:
129
130all: $(PROG) $(TXTS) $(SUBDIRS)
131
132# multi-object targets
133#
134spray:	$(SCLNTOBJS)
135	$(LINK.c) $(SCLNTOBJS) -o $@ $(LDLIBS)
136	$(POST_PROCESS)
137
138spray_svc.o spray_clnt.o: spray.h
139
140rpc.sprayd: $(SSVCOBJS)
141	$(LINK.c) $(SSVCOBJS) -o $@ $(LDLIBS)
142	$(POST_PROCESS)
143
144rwall_svc.o rwall_clnt.o: rwall.h
145
146rwall: $(WCLNTOBJS)
147	$(LINK.c) $(WCLNTOBJS) -o $@ $(LDLIBS)
148	$(POST_PROCESS)
149
150rpc.rwalld: $(WSVCOBJS)
151	$(LINK.c) $(WSVCOBJS) -o $@ $(LDLIBS)
152	$(POST_PROCESS)
153
154rstat_main.o:	rstat.h rstat_v2.h
155
156rstat_svc.o: rstat.h
157
158rstat_V2_svc.o rstat_V2_xdr.o: rstat_v2.h
159
160rpc.rstatd: $(TSVCOBJS)
161	$(LINK.c) $(TSVCOBJS) -o $@ $(LDLIBS)
162	$(POST_PROCESS)
163
164install: $(PROG) $(TXTS) .WAIT $(ROOTDIRS) .WAIT $(IBINPROG) $(ISBINPROG) \
165	$(IWPROG) $(ISPROG) $(IRPROG) $(ITPROG) $(IETCFILES) $(SUBDIRS) \
166	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
167
168$(ROOTDIRS):
169	$(INS.dir)
170
171$(SUBDIRS): FRC
172	@cd $@; pwd; $(MAKE) $(TARGET)
173
174#
175# Derived files
176#
177
178rstat.x: $(PROTOCOL_DIR)/rstat.x
179	$(RM) rstat.x
180	$(CP) $(PROTOCOL_DIR)/rstat.x rstat.x
181
182rstat.h: $(PROTOCOL_DIR)/rstat.h
183	$(RM) rstat.h
184	$(CP) $(PROTOCOL_DIR)/rstat.h rstat.h
185
186rstat_svc.c: rstat.x
187	$(RPCGEN) -C -m rstat.x > $@
188
189rstat_v2.h: rstat_v2.x
190	$(RPCGEN) -C -h rstat_v2.x > $@
191
192rstat_v2_svc.c: rstat_v2.x
193	$(RPCGEN) -C -m rstat_v2.x > $@
194
195rstat_v2_xdr.c: rstat_v2.x
196	$(RPCGEN) -c rstat_v2.x > $@
197
198spray.x: $(PROTOCOL_DIR)/spray.x
199	$(RM) spray.x
200	$(CP) $(PROTOCOL_DIR)/spray.x spray.x
201
202spray.h: $(PROTOCOL_DIR)/spray.h
203	$(RM) spray.h
204	$(CP) $(PROTOCOL_DIR)/spray.h spray.h
205
206spray_svc.c: spray.x
207	$(RPCGEN) -s datagram_v -s circuit_v spray.x > $@
208
209spray_clnt.c: spray.x
210	$(RPCGEN) -l spray.x > $@
211
212rwall.x: $(PROTOCOL_DIR)/rwall.x
213	$(RM) rwall.x
214	$(CP) $(PROTOCOL_DIR)/rwall.x rwall.x
215
216rwall.h: $(PROTOCOL_DIR)/rwall.h
217	$(RM) rwall.h
218	$(CP) $(PROTOCOL_DIR)/rwall.h rwall.h
219
220rwall_svc.c: rwall.x
221	$(RPCGEN) -A -s datagram_v rwall.x > $@
222
223rwall_clnt.c: rwall.x
224	$(RPCGEN) -l -M rwall.x > $@
225
226check:	$(CHKMANIFEST)
227
228clean: $(SUBDIRS)
229	-$(RM) $(OBJS) $(DERIVED_FILES)
230
231clobber: $(SUBDIRS)
232
233lint:
234	$(LINT.c) $(WCLNTOBJS:%.o=%.c) -lnsl -lrpcsvc
235	$(LINT.c) $(WSVCOBJS:%.o=%.c) -lnsl -lrpcsvc
236	$(LINT.c) rusers.c -lnsl -lrpcsvc
237
238FRC:
239
240include ../Makefile.targ
241