1# Copyright (C) 1994-2021 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# 21subdir := sunrpc 22 23include ../Makeconfig 24 25ifdef 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 49ifeq ($(build-shared),yes) 50need-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 56routines := 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. 64shared-only-routines = $(routines) 65endif 66 67tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ 68 tst-udp-nonblocking 69xtests := tst-getmyaddr 70 71ifeq ($(have-thread-library),yes) 72xtests += thrsvc 73tests += tst-udp-garbage tst-svc_register 74endif 75 76ifeq (yes,$(build-shared)) 77rpc-compat-routines = $(addprefix compat-,$(need-export-routines)) 78rpc-compat-routines.os = $(addprefix $(objpfx), \ 79 $(addsuffix .os,$(rpc-compat-routines))) 80extra-objs += $(addsuffix .os,$(rpc-compat-routines)) 81endif 82 83include ../Rules 84 85ifeq (yes,$(build-shared)) 86subdir_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 91endif 92 93CFLAGS-auth_unix.c += -fexceptions 94CFLAGS-key_call.c += -fexceptions 95CFLAGS-pmap_rmt.c += -fexceptions 96CFLAGS-clnt_perr.c += -fexceptions 97CFLAGS-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 113else # !have-GLIBC_2.31 114 115routines = $(routines-for-nss) 116 117include ../Rules 118 119ifeq (yes,$(build-shared)) 120# Create an empty archive, so that Makerules can reference it. 121subdir_lib: $(objpfx)librpc_compat_pic.a 122$(objpfx)librpc_compat_pic.a: Makefile 123 $(make-target-directory) 124 $(AR) cr $@ 125endif 126 127 128endif # !have-GLIBC_2.31 129