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