(client_ops): Mark as const.
[kopensolaris-gnu/glibc.git] / sunrpc / Makefile
index 7f81218..bc826af 100644 (file)
@@ -1,20 +1,20 @@
-# Copyright (C) 1994,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+# Copyright (C) 1994-2004, 2005 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
 
 # The GNU C Library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
+# Lesser General Public License for more details.
 
-# You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB.  If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
 
 #
 #      Sub-makefile for sunrpc portion of the library.
@@ -54,13 +54,14 @@ headers = $(addprefix rpc/,auth.h auth_unix.h clnt.h netdb.h pmap_clnt.h \
          $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
 install-others = $(inst_sysconfdir)/rpc
 generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
-           $(rpcsvc:%.x=rpcsvc/%.stmp) rpc-proto.c rpc-proto.d rpcgen
+           $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
+generated-dirs := rpcsvc
 
 routines := auth_none auth_unix authuxprot bindrsvprt \
            clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
            clnt_udp rpc_dtable get_myaddr getrpcport \
            pmap_clnt pm_getmaps pm_getport pmap_prot \
-           pmap_prot2 pmap_rmt rpc_prot rpc_common rpc_cmsg \
+           pmap_prot2 pmap_rmt rpc_prot rpc_common rpc_cmsg rpc_thread \
            svc svc_auth svc_authux svc_raw svc_run svc_simple \
            svc_tcp svc_udp xdr xdr_array xdr_float xdr_mem \
            xdr_rec xdr_ref xdr_stdio publickey xdr_sizeof \
@@ -84,6 +85,14 @@ all: # Make this the default target; it will be defined in Rules.
 
 include ../Makeconfig
 
+tests = tst-xdrmem
+xtests := tst-getmyaddr
+
+ifeq ($(have-thread-library),yes)
+xtests += thrsvc
+endif
+distribute += thrsvc.c
+
 ifeq (yes,$(build-static-nss))
 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
             $(resolvobjdir)/libresolv.a
@@ -99,23 +108,26 @@ librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
 omit-deps = $(librpcsvc-routines)
 endif
 
-CFLAGS-xbootparam_prot.c = -Wno-unused
-CFLAGS-xnlm_prot.c = -Wno-unused
-CFLAGS-xrstat.c = -Wno-unused
-CFLAGS-xyppasswd.c = -Wno-unused
-CFLAGS-xklm_prot.c = -Wno-unused
-CFLAGS-xrex.c = -Wno-unused
-CFLAGS-xsm_inter.c = -Wno-unused
-CFLAGS-xmount.c = -Wno-unused
-CFLAGS-xrusers.c = -Wno-unused
-CFLAGS-xspray.c = -Wno-unused
-CFLAGS-xnfs_prot.c = -Wno-unused
-CFLAGS-xrquota.c = -Wno-unused
-CFLAGS-xkey_prot.c = -Wno-unused
-
-ifeq (yes,$(have_doors))
-CPPFLAGS-key_call.c += -DHAVE_DOORS=1
-endif
+CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrstat.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xyppasswd.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xklm_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrex.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xsm_inter.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xmount.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrusers.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xspray.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xnfs_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrquota.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xkey_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-auth_unix.c = -fexceptions
+CFLAGS-key_call.c = -fexceptions
+CFLAGS-pmap_rmt.c = -fexceptions
+CFLAGS-clnt_perr.c = -fexceptions
+CFLAGS-openchild.c = -fexceptions
+
+CPPFLAGS += -D_RPC_THREAD_SAFE_
 
 include ../Rules
 
@@ -124,9 +136,13 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
        $(+link)
 
+# This makes sure -DNOT_IN_libc is passed for all these modules.
+cpp-srcs-left := $(rpcgen-objs:.o=.c)
+lib := nonlib
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+
 # Tell rpcgen where to find the C preprocessor.
-rpcgen-cmd = $(built-program-cmd) -Y `$(CC) -print-file-name=cpp | \
-                                     sed 's|/cpp$$||'`
+rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
 
 # Install the rpc data base file.
 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
@@ -157,24 +173,20 @@ $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
 # Gratuitous dependency on generated .c file here just gets it mentioned to
 # avoid being an intermediate file and getting removed.
 define o-iterator-doit
-$(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h \
-                                           $(objpfx)rpc-proto.d
+$(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
 endef
 object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes))
 include $(o-iterator)
 
-ifndef no_deps
--include $(objpfx)rpc-proto.d
+rpcsvc-dt-files := $(foreach o,$(filter-out $(librpcsvc-inhibit-o),\
+                                           $(object-suffixes)),\
+                            $(rpcsvc:%.x=$(objpfx)x%$o.dt))
+rpcsvc-depfiles := $(patsubst %.dt,%.d,$(wildcard $(rpcsvc-dt-files))) \
+                  $(wildcard $(rpcsvc-dt-files:.dt=.d))
+ifdef rpcsvc-depfiles
+ifneq ($(no_deps),t)
+-include $(rpcsvc-depfiles)
+endif
 endif
 
-$(objpfx)rpc-proto.d: $(objpfx)%.d: $(objpfx)%.c
-       $(+make-deps)
-# Special file to generate dependencies for the RPC service objects.
-# Collect all include directives from the source files.
-$(objpfx)rpc-proto.c: $(rpcsvc:%=rpcsvc/%)
-       $(make-target-directory)
-       { echo '#include <rpc/types.h>'; \
-         echo '#include <rpc/xdr.h>'; \
-         echo '#include <rpc/rpc.h>'; \
-         sed -n '/^%#include/s/%//p' $^; } > $@T
-       mv -f $@T $@
+$(objpfx)thrsvc: $(shared-thread-library)