S390: Move utf16-utf32-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
[glibc.git] / sunrpc / Makefile
bloba5177fffdc7c682ee18aec2da59f1d0b1a6e365c
1 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 # Sub-makefile for sunrpc portion of the library.
21 subdir := sunrpc
23 include ../Makeconfig
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
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:
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
48 rpcsvc = bootparam_prot.x nlm_prot.x rstat.x \
49 yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
50 rusers.x spray.x nfs_prot.x rquota.x key_prot.x
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 \
54 des_crypt.h key_prot.h rpc_des.h) \
55 $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
56 headers = rpc/netdb.h
57 install-others = $(inst_sysconfdir)/rpc
58 generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
59 $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
60 generated-dirs += rpcsvc
62 ifeq ($(link-obsolete-rpc),yes)
63 headers += $(headers-sunrpc)
64 endif
66 ifeq ($(build-shared),yes)
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 \
70 xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
71 svc_run
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 \
76 svc_simple xdr_float xdr_rec publickey authdes_prot \
77 des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
78 getrpcent getrpcbyname getrpcbynumber \
79 getrpcent_r getrpcbyname_r getrpcbynumber_r \
80 clnt_unix svc_unix create_xid $(need-export-routines) \
81 rpc_gethostbyname
82 ifneq ($(link-obsolete-rpc),yes)
83 # We only add the RPC for compatibility to libc.so.
84 shared-only-routines = $(routines)
85 endif
86 endif
88 ifeq ($(link-obsolete-rpc),yes)
89 install-bin := rpcgen
90 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
91 rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
92 rpc_tblout.o rpc_sample.o
93 extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
94 others += rpcgen
95 endif
97 tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
98 tst-udp-nonblocking
99 xtests := tst-getmyaddr
101 ifeq ($(have-thread-library),yes)
102 xtests += thrsvc
103 tests += tst-svc_register tst-udp-garbage
104 endif
106 ifeq ($(run-built-tests),yes)
107 ifeq ($(link-obsolete-rpc),yes)
108 rpcgen-tests := $(objpfx)bug20790.out
109 tests-special += $(rpcgen-tests)
110 endif
111 endif
113 ifeq ($(link-obsolete-rpc),yes)
114 headers += $(rpcsvc:%.x=rpcsvc/%.h)
115 extra-libs := librpcsvc
116 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
117 librpcsvc-routines = $(rpcsvc:%.x=x%)
118 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
119 omit-deps = $(librpcsvc-routines)
120 endif
122 ifeq (yes,$(build-shared))
123 rpc-compat-routines = $(addprefix compat-,$(need-export-routines))
124 rpc-compat-routines.os = $(addprefix $(objpfx), \
125 $(addsuffix .os,$(rpc-compat-routines)))
126 extra-objs += $(addsuffix .os,$(rpc-compat-routines))
127 endif
129 include ../Rules
131 ifeq (yes,$(build-shared))
132 subdir_lib: $(objpfx)librpc_compat_pic.a
133 $(objpfx)librpc_compat_pic.a: $(rpc-compat-routines.os)
134 $(AR) cr$(verbose) $@ $^
135 $(rpc-compat-routines.os): $(objpfx)compat-%.os: %.c $(before-compile)
136 $(compile-command.c) -DEXPORT_RPC_SYMBOLS
137 endif
139 CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
140 CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)
141 CFLAGS-xrstat.c = -Wno-unused $(PIC-ccflag)
142 CFLAGS-xyppasswd.c = -Wno-unused $(PIC-ccflag)
143 CFLAGS-xklm_prot.c = -Wno-unused $(PIC-ccflag)
144 CFLAGS-xrex.c = -Wno-unused $(PIC-ccflag)
145 CFLAGS-xsm_inter.c = -Wno-unused $(PIC-ccflag)
146 CFLAGS-xmount.c = -Wno-unused $(PIC-ccflag)
147 CFLAGS-xrusers.c = -Wno-unused $(PIC-ccflag)
148 CFLAGS-xspray.c = -Wno-unused $(PIC-ccflag)
149 CFLAGS-xnfs_prot.c = -Wno-unused $(PIC-ccflag)
150 CFLAGS-xrquota.c = -Wno-unused $(PIC-ccflag)
151 CFLAGS-xkey_prot.c = -Wno-unused $(PIC-ccflag)
152 CFLAGS-auth_unix.c = -fexceptions
153 CFLAGS-key_call.c = -fexceptions
154 CFLAGS-pmap_rmt.c = -fexceptions
155 CFLAGS-clnt_perr.c = -fexceptions
156 CFLAGS-openchild.c = -fexceptions
158 sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_
159 CPPFLAGS += $(sunrpc-CPPFLAGS)
160 BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS)
162 $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
163 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
164 $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
165 $(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so
166 $(objpfx)tst-svc_register: \
167 $(common-objpfx)linkobj/libc.so $(shared-thread-library)
169 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs))
171 cross-rpcgen-objs := $(addprefix $(objpfx)cross-,$(rpcgen-objs))
173 # When generic makefile support for build system programs is
174 # available, it should replace this code. See
175 # <http://sourceware.org/bugzilla/show_bug.cgi?id=14087>.
176 $(cross-rpcgen-objs): $(objpfx)cross-%.o: %.c $(before-compile)
177 $(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) $< \
178 $(OUTPUT_OPTION) $(native-compile-mkdep-flags) -c
180 $(objpfx)cross-rpcgen: $(cross-rpcgen-objs)
181 $(BUILD_CC) $^ $(BUILD_LDFLAGS) -o $@
183 # This makes sure -DIN_MODULE is passed for all these modules.
184 cpp-srcs-left := $(rpcgen-objs:.o=.c)
185 lib := nonlib
186 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
188 # How we run rpcgen to generate sources and headers in the rules below.
189 # Setting CPP tells it how to run the C preprocessor correctly. Note
190 # that $(built-program-file) requires that the just-built cross-rpcgen
191 # binary be the second dependency listed in each rule using rpcgen-cmd.
192 rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-file) -Y ../scripts
194 # Install the rpc data base file.
195 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
196 $(do-install)
198 # Generate the rpcsvc headers with rpcgen.
199 # We use a stamp file to avoid unnessary recompilation each time rpcgen is
200 # relinked.
201 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
203 $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen
204 $(make-target-directory)
205 -@rm -f ${@:stmp=T} $@
206 $(rpcgen-cmd) -h $< -o ${@:stmp=T}
207 $(move-if-change) $(@:stmp=T) $(@:stmp=h)
208 touch $@
210 # Generate the rpcsvc XDR functions with rpcgen.
211 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
213 $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen
214 -@rm -f ${@:stmp=T} $@
215 $(rpcgen-cmd) -c $< -o ${@:stmp=T}
216 $(move-if-change) $(@:stmp=T) $(@:stmp=c)
217 touch $@
219 # The generated source files depend on the corresponding generated headers.
220 # Gratuitous dependency on generated .c file here just gets it mentioned to
221 # avoid being an intermediate file and getting removed.
222 define o-iterator-doit
223 $(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
224 endef
225 object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes))
226 include $(o-iterator)
228 rpcsvc-dt-files := $(foreach o,$(filter-out $(librpcsvc-inhibit-o),\
229 $(object-suffixes)),\
230 $(rpcsvc:%.x=$(objpfx)x%$o.dt))
231 rpcsvc-depfiles := $(patsubst %.dt,%.d,$(wildcard $(rpcsvc-dt-files))) \
232 $(wildcard $(rpcsvc-dt-files:.dt=.d))
233 ifdef rpcsvc-depfiles
234 ifneq ($(no_deps),t)
235 -include $(rpcsvc-depfiles)
236 endif
237 endif
239 $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)
241 ifeq ($(run-built-tests),yes)
242 $(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen
243 -rm -f $@
244 $(built-program-cmd) -c $< -o $@; \
245 $(evaluate-test)
246 endif
248 $(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so
249 $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
250 $(objpfx)tst-udp-garbage: \
251 $(common-objpfx)linkobj/libc.so $(shared-thread-library)