]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | # Copyright (C) 1994-2019 Free Software Foundation, Inc. |
28f540f4 RM |
2 | # This file is part of the GNU C Library. |
3 | ||
4 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | # modify it under the terms of the GNU Lesser General Public |
6 | # License as published by the Free Software Foundation; either | |
7 | # version 2.1 of the License, or (at your option) any later version. | |
28f540f4 RM |
8 | |
9 | # The GNU C Library is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | # Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | # You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | # License along with the GNU C Library; if not, see |
16 | # <http://www.gnu.org/licenses/>. | |
28f540f4 RM |
17 | |
18 | # | |
19 | # Sub-makefile for sunrpc portion of the library. | |
20 | # | |
21 | subdir := sunrpc | |
22 | ||
a5f891ac JM |
23 | include ../Makeconfig |
24 | ||
0d204b0a UD |
25 | # The code in this subdirectory is taken from Sun's RPCSRC-4.0 |
26 | # distribution with some additional changes from the TI-RPC package | |
714a562f UD |
27 | # which is also available from Sun. The files are heavily changed to |
28 | # compile cleanly and to fit in the GNU environment. All the code | |
29 | # from Sun's rpc, etc, and rpcgen subdirectories is in this directory; | |
30 | # the rpc subdirectory contains only the header files. Other than | |
31 | # that, several files were renamed so as not to exceed 14-character | |
32 | # file name limits: | |
28f540f4 RM |
33 | # |
34 | # authunix_prot.c -> authuxprot.c | |
35 | # bindresvport.c -> bindrsvprt.c | |
36 | # clnt_generic.c -> clnt_gen.c | |
37 | # clnt_perror.c -> clnt_perr.c | |
38 | # clnt_simple.c -> clnt_simp.c | |
39 | # get_myaddress.c -> get_myaddr.c | |
40 | # pmap_getmaps.c -> pm_getmaps.c | |
41 | # pmap_getport.c -> pm_getport.c | |
42 | # rpc_callmsg.c -> rpc_cmsg.c | |
43 | # rpc_commondata.c -> rpc_common.c | |
44 | # rpc_dtablesize.c -> rpc_dtable.c | |
45 | # svc_auth_unix.c -> svc_authux.c | |
46 | # xdr_reference.c -> xdr_ref.c | |
28f540f4 | 47 | |
b02f5013 | 48 | rpcsvc = bootparam_prot.x nlm_prot.x rstat.x \ |
28f540f4 | 49 | yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \ |
800d775e | 50 | rusers.x spray.x nfs_prot.x rquota.x key_prot.x |
6af0e510 TK |
51 | headers-sunrpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \ |
52 | pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h \ | |
53 | svc.h svc_auth.h types.h xdr.h auth_des.h \ | |
b10a0acc | 54 | key_prot.h) \ |
7b57bfe5 | 55 | $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h |
597df647 | 56 | headers = rpc/netdb.h |
19361cb7 | 57 | install-others = $(inst_sysconfdir)/rpc |
f08e9a26 RM |
58 | generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \ |
59 | $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen | |
60 | generated-dirs += rpcsvc | |
28f540f4 | 61 | |
021db4be | 62 | ifeq ($(link-obsolete-rpc),yes) |
6af0e510 | 63 | headers += $(headers-sunrpc) |
021db4be AJ |
64 | endif |
65 | ||
3f2e46a4 | 66 | ifeq ($(build-shared),yes) |
7b57bfe5 UD |
67 | need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \ |
68 | clnt_udp get_myaddr key_call netname pm_getport \ | |
69 | rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \ | |
4df46dbd L |
70 | xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \ |
71 | svc_run | |
7b57bfe5 UD |
72 | |
73 | routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \ | |
74 | rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \ | |
75 | pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \ | |
4df46dbd | 76 | svc_simple xdr_float xdr_rec publickey authdes_prot \ |
7b57bfe5 | 77 | des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \ |
a1309c2b RM |
78 | getrpcent getrpcbyname getrpcbynumber \ |
79 | getrpcent_r getrpcbyname_r getrpcbynumber_r \ | |
5c6e6747 FW |
80 | clnt_unix svc_unix create_xid $(need-export-routines) \ |
81 | rpc_gethostbyname | |
021db4be | 82 | ifneq ($(link-obsolete-rpc),yes) |
7b57bfe5 UD |
83 | # We only add the RPC for compatibility to libc.so. |
84 | shared-only-routines = $(routines) | |
85 | endif | |
021db4be | 86 | endif |
7b57bfe5 | 87 | |
6af0e510 | 88 | ifeq ($(link-obsolete-rpc),yes) |
28f540f4 | 89 | install-bin := rpcgen |
28f540f4 | 90 | rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ |
0d204b0a UD |
91 | rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \ |
92 | rpc_tblout.o rpc_sample.o | |
656416c9 | 93 | extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs)) |
9a07f9d0 | 94 | others += rpcgen |
6af0e510 | 95 | endif |
693e7b96 | 96 | |
cf0bd2f7 FW |
97 | tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ |
98 | tst-udp-nonblocking | |
4f21c95d UD |
99 | xtests := tst-getmyaddr |
100 | ||
c238ecf7 UD |
101 | ifeq ($(have-thread-library),yes) |
102 | xtests += thrsvc | |
7c3018f9 ZW |
103 | tests += tst-udp-garbage |
104 | tests-internal += tst-svc_register | |
c238ecf7 UD |
105 | endif |
106 | ||
5874510f | 107 | ifeq ($(run-built-tests),yes) |
c3812045 | 108 | ifeq ($(link-obsolete-rpc),yes) |
5874510f JM |
109 | rpcgen-tests := $(objpfx)bug20790.out |
110 | tests-special += $(rpcgen-tests) | |
111 | endif | |
c3812045 | 112 | endif |
5874510f | 113 | |
6af0e510 | 114 | ifeq ($(link-obsolete-rpc),yes) |
6952e59e | 115 | headers += $(rpcsvc:%.x=rpcsvc/%.h) |
693e7b96 | 116 | extra-libs := librpcsvc |
dbe31b9a | 117 | extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. |
693e7b96 | 118 | librpcsvc-routines = $(rpcsvc:%.x=x%) |
40a55d20 | 119 | librpcsvc-inhibit-o = .os # Build no shared rpcsvc library. |
693e7b96 | 120 | omit-deps = $(librpcsvc-routines) |
6af0e510 | 121 | endif |
28f540f4 | 122 | |
7b57bfe5 UD |
123 | ifeq (yes,$(build-shared)) |
124 | rpc-compat-routines = $(addprefix compat-,$(need-export-routines)) | |
125 | rpc-compat-routines.os = $(addprefix $(objpfx), \ | |
126 | $(addsuffix .os,$(rpc-compat-routines))) | |
da392631 AS |
127 | extra-objs += $(addsuffix .os,$(rpc-compat-routines)) |
128 | endif | |
129 | ||
130 | include ../Rules | |
131 | ||
132 | ifeq (yes,$(build-shared)) | |
7b57bfe5 UD |
133 | subdir_lib: $(objpfx)librpc_compat_pic.a |
134 | $(objpfx)librpc_compat_pic.a: $(rpc-compat-routines.os) | |
135 | $(AR) cr$(verbose) $@ $^ | |
53cf59ef | 136 | $(rpc-compat-routines.os): $(objpfx)compat-%.os: %.c $(before-compile) |
7b57bfe5 UD |
137 | $(compile-command.c) -DEXPORT_RPC_SYMBOLS |
138 | endif | |
139 | ||
36975e8e L |
140 | CFLAGS-xbootparam_prot.c += -Wno-unused $(PIC-ccflag) |
141 | CFLAGS-xnlm_prot.c += -Wno-unused $(PIC-ccflag) | |
142 | CFLAGS-xrstat.c += -Wno-unused $(PIC-ccflag) | |
143 | CFLAGS-xyppasswd.c += -Wno-unused $(PIC-ccflag) | |
144 | CFLAGS-xklm_prot.c += -Wno-unused $(PIC-ccflag) | |
145 | CFLAGS-xrex.c += -Wno-unused $(PIC-ccflag) | |
146 | CFLAGS-xsm_inter.c += -Wno-unused $(PIC-ccflag) | |
147 | CFLAGS-xmount.c += -Wno-unused $(PIC-ccflag) | |
148 | CFLAGS-xrusers.c += -Wno-unused $(PIC-ccflag) | |
149 | CFLAGS-xspray.c += -Wno-unused $(PIC-ccflag) | |
150 | CFLAGS-xnfs_prot.c += -Wno-unused $(PIC-ccflag) | |
151 | CFLAGS-xrquota.c += -Wno-unused $(PIC-ccflag) | |
152 | CFLAGS-xkey_prot.c += -Wno-unused $(PIC-ccflag) | |
153 | CFLAGS-auth_unix.c += -fexceptions | |
154 | CFLAGS-key_call.c += -fexceptions | |
155 | CFLAGS-pmap_rmt.c += -fexceptions | |
156 | CFLAGS-clnt_perr.c += -fexceptions | |
157 | CFLAGS-openchild.c += -fexceptions | |
e7fd8a39 | 158 | |
7b57bfe5 UD |
159 | $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so |
160 | $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so | |
161 | $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so | |
d42eed4a | 162 | $(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so |
37fb019c FW |
163 | $(objpfx)tst-svc_register: \ |
164 | $(common-objpfx)linkobj/libc.so $(shared-thread-library) | |
7b57bfe5 | 165 | |
9a07f9d0 | 166 | $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) |
28f540f4 | 167 | |
28e72501 | 168 | cross-rpcgen-objs := $(addprefix $(objpfx)cross-,$(rpcgen-objs)) |
28e72501 MK |
169 | |
170 | # When generic makefile support for build system programs is | |
171 | # available, it should replace this code. See | |
a306c790 | 172 | # <https://sourceware.org/bugzilla/show_bug.cgi?id=14087>. |
656416c9 | 173 | $(cross-rpcgen-objs): $(objpfx)cross-%.o: %.c $(before-compile) |
28e72501 | 174 | $(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) $< \ |
656416c9 | 175 | $(OUTPUT_OPTION) $(native-compile-mkdep-flags) -c |
28e72501 MK |
176 | |
177 | $(objpfx)cross-rpcgen: $(cross-rpcgen-objs) | |
178 | $(BUILD_CC) $^ $(BUILD_LDFLAGS) -o $@ | |
179 | ||
4f41c682 | 180 | # This makes sure -DIN_MODULE is passed for all these modules. |
0f283ffc | 181 | cpp-srcs-left := $(rpcgen-objs:.o=.c) |
0a951d0e | 182 | lib := nonlib |
2bfdaedd | 183 | include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) |
0f283ffc | 184 | |
28e72501 MK |
185 | # How we run rpcgen to generate sources and headers in the rules below. |
186 | # Setting CPP tells it how to run the C preprocessor correctly. Note | |
187 | # that $(built-program-file) requires that the just-built cross-rpcgen | |
188 | # binary be the second dependency listed in each rule using rpcgen-cmd. | |
189 | rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-file) -Y ../scripts | |
28f540f4 | 190 | |
28f540f4 | 191 | # Install the rpc data base file. |
73237de3 | 192 | $(inst_sysconfdir)/rpc: etc.rpc $(+force) |
28f540f4 | 193 | $(do-install) |
28f540f4 | 194 | \f |
28f540f4 | 195 | # Generate the rpcsvc headers with rpcgen. |
c0e45674 UD |
196 | # We use a stamp file to avoid unnessary recompilation each time rpcgen is |
197 | # relinked. | |
d705269e UD |
198 | $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp |
199 | @: | |
28e72501 | 200 | $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen |
28f540f4 | 201 | $(make-target-directory) |
c0e45674 | 202 | -@rm -f ${@:stmp=T} $@ |
e57931a8 | 203 | $(rpcgen-cmd) -h $< -o ${@:stmp=T} |
b17277cf | 204 | $(move-if-change) $(@:stmp=T) $(@:stmp=h) |
c0e45674 | 205 | touch $@ |
0d204b0a | 206 | |
28f540f4 | 207 | # Generate the rpcsvc XDR functions with rpcgen. |
d705269e UD |
208 | $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp |
209 | @: | |
28e72501 | 210 | $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen |
c0e45674 | 211 | -@rm -f ${@:stmp=T} $@ |
e57931a8 | 212 | $(rpcgen-cmd) -c $< -o ${@:stmp=T} |
b17277cf | 213 | $(move-if-change) $(@:stmp=T) $(@:stmp=c) |
c0e45674 UD |
214 | touch $@ |
215 | ||
28f540f4 RM |
216 | # The generated source files depend on the corresponding generated headers. |
217 | # Gratuitous dependency on generated .c file here just gets it mentioned to | |
218 | # avoid being an intermediate file and getting removed. | |
e57931a8 | 219 | define o-iterator-doit |
54c92465 | 220 | $(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h |
e57931a8 UD |
221 | endef |
222 | object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes)) | |
223 | include $(o-iterator) | |
377a515b | 224 | |
54c92465 UD |
225 | rpcsvc-dt-files := $(foreach o,$(filter-out $(librpcsvc-inhibit-o),\ |
226 | $(object-suffixes)),\ | |
227 | $(rpcsvc:%.x=$(objpfx)x%$o.dt)) | |
228 | rpcsvc-depfiles := $(patsubst %.dt,%.d,$(wildcard $(rpcsvc-dt-files))) \ | |
229 | $(wildcard $(rpcsvc-dt-files:.dt=.d)) | |
230 | ifdef rpcsvc-depfiles | |
231 | ifneq ($(no_deps),t) | |
232 | -include $(rpcsvc-depfiles) | |
233 | endif | |
377a515b | 234 | endif |
c238ecf7 | 235 | |
4df46dbd | 236 | $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library) |
5874510f JM |
237 | |
238 | ifeq ($(run-built-tests),yes) | |
239 | $(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen | |
8888eb5e | 240 | -rm -f $@ |
5874510f JM |
241 | $(built-program-cmd) -c $< -o $@; \ |
242 | $(evaluate-test) | |
243 | endif | |
cf0bd2f7 FW |
244 | |
245 | $(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so | |
246 | $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so | |
247 | $(objpfx)tst-udp-garbage: \ | |
248 | $(common-objpfx)linkobj/libc.so $(shared-thread-library) |