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