9a31fe48b9f44b94ff069d8b8e9687020024f0cf
[platform/upstream/glibc.git] / sunrpc / Makefile
1 # Copyright (C) 1994-2022 Free Software Foundation, Inc.
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
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.
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
12 # Lesser General Public License for more details.
13
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 # <https://www.gnu.org/licenses/>.
17
18 #
19 #       Sub-makefile for sunrpc portion of the library.
20 #
21 subdir  := sunrpc
22
23 include ../Makeconfig
24
25 ifdef have-GLIBC_2.31
26
27 # The code in this subdirectory is taken from Sun's RPCSRC-4.0
28 # distribution with some additional changes from the TI-RPC package
29 # which is also available from Sun.  The files are heavily changed to
30 # compile cleanly and to fit in the GNU environment.  All the code
31 # from Sun's rpc and etc subdirectories is in this directory;
32 # the rpc subdirectory contains only the header files.  Other than
33 # that, several files were renamed so as not to exceed 14-character
34 # file name limits:
35 #
36 #       authunix_prot.c -> authuxprot.c
37 #       clnt_generic.c -> clnt_gen.c
38 #       clnt_perror.c -> clnt_perr.c
39 #       clnt_simple.c -> clnt_simp.c
40 #       get_myaddress.c -> get_myaddr.c
41 #       pmap_getmaps.c -> pm_getmaps.c
42 #       pmap_getport.c -> pm_getport.c
43 #       rpc_callmsg.c -> rpc_cmsg.c
44 #       rpc_commondata.c -> rpc_common.c
45 #       rpc_dtablesize.c -> rpc_dtable.c
46 #       svc_auth_unix.c -> svc_authux.c
47 #       xdr_reference.c -> xdr_ref.c
48
49 ifeq ($(build-shared),yes)
50 need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
51                         clnt_udp get_myaddr key_call netname pm_getport \
52                         rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
53                         xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
54                         svc_run
55
56 routines := auth_none authuxprot clnt_raw clnt_simp \
57             rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
58             pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
59             svc_simple xdr_float xdr_rec publickey authdes_prot \
60             des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
61             clnt_unix svc_unix create_xid $(need-export-routines) \
62             rpc_gethostbyname
63 # We only add the RPC for compatibility to libc.so.
64 shared-only-routines = $(routines)
65 endif
66
67 tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
68   tst-udp-nonblocking
69 xtests := tst-getmyaddr
70
71 ifeq ($(have-thread-library),yes)
72 xtests += thrsvc
73 tests += tst-udp-garbage tst-svc_register
74 endif
75
76 ifeq (yes,$(build-shared))
77 rpc-compat-routines = $(addprefix compat-,$(need-export-routines))
78 rpc-compat-routines.os = $(addprefix $(objpfx), \
79                                      $(addsuffix .os,$(rpc-compat-routines)))
80 extra-objs += $(addsuffix .os,$(rpc-compat-routines))
81 endif
82
83 include ../Rules
84
85 ifeq (yes,$(build-shared))
86 subdir_lib: $(objpfx)librpc_compat_pic.a
87 $(objpfx)librpc_compat_pic.a: $(rpc-compat-routines.os)
88         $(AR) cr$(verbose) $@ $^
89 $(rpc-compat-routines.os): $(objpfx)compat-%.os: %.c $(before-compile)
90         $(compile-command.c) -DEXPORT_RPC_SYMBOLS
91 endif
92
93 CFLAGS-auth_unix.c += -fexceptions
94 CFLAGS-key_call.c += -fexceptions
95 CFLAGS-pmap_rmt.c += -fexceptions
96 CFLAGS-clnt_perr.c += -fexceptions
97 CFLAGS-openchild.c += -fexceptions
98
99 $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
100 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
101 $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
102 $(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so
103 $(objpfx)tst-svc_register: \
104   $(common-objpfx)linkobj/libc.so $(shared-thread-library)
105
106 $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)
107
108 $(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so
109 $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
110 $(objpfx)tst-udp-garbage: \
111   $(common-objpfx)linkobj/libc.so $(shared-thread-library)
112
113 else # !have-GLIBC_2.31
114
115 routines = $(routines-for-nss)
116
117 include ../Rules
118
119 ifeq (yes,$(build-shared))
120 # Create an empty archive, so that Makerules can reference it.
121 subdir_lib: $(objpfx)librpc_compat_pic.a
122 $(objpfx)librpc_compat_pic.a: Makefile
123         $(make-target-directory)
124         $(AR) cr $@
125 endif
126
127
128 endif # !have-GLIBC_2.31