Blame sunrpc/Makefile

Packit Service 82fcde
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
Packit Service 82fcde
# This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
# The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
# modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
# License as published by the Free Software Foundation; either
Packit Service 82fcde
# version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
# The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
# Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
# You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
# License along with the GNU C Library; if not, see
Packit Service 82fcde
# <http://www.gnu.org/licenses/>.
Packit Service 82fcde
Packit Service 82fcde
#
Packit Service 82fcde
#	Sub-makefile for sunrpc portion of the library.
Packit Service 82fcde
#
Packit Service 82fcde
subdir	:= sunrpc
Packit Service 82fcde
Packit Service 82fcde
include ../Makeconfig
Packit Service 82fcde
Packit Service 82fcde
# The code in this subdirectory is taken from Sun's RPCSRC-4.0
Packit Service 82fcde
# distribution with some additional changes from the TI-RPC package
Packit Service 82fcde
# which is also available from Sun.  The files are heavily changed to
Packit Service 82fcde
# compile cleanly and to fit in the GNU environment.  All the code
Packit Service 82fcde
# from Sun's rpc, etc, and rpcgen subdirectories is in this directory;
Packit Service 82fcde
# the rpc subdirectory contains only the header files.  Other than
Packit Service 82fcde
# that, several files were renamed so as not to exceed 14-character
Packit Service 82fcde
# file name limits:
Packit Service 82fcde
#
Packit Service 82fcde
#	authunix_prot.c -> authuxprot.c
Packit Service 82fcde
#	bindresvport.c -> bindrsvprt.c
Packit Service 82fcde
#	clnt_generic.c -> clnt_gen.c
Packit Service 82fcde
#	clnt_perror.c -> clnt_perr.c
Packit Service 82fcde
#	clnt_simple.c -> clnt_simp.c
Packit Service 82fcde
#	get_myaddress.c -> get_myaddr.c
Packit Service 82fcde
#	pmap_getmaps.c -> pm_getmaps.c
Packit Service 82fcde
#	pmap_getport.c -> pm_getport.c
Packit Service 82fcde
#	rpc_callmsg.c -> rpc_cmsg.c
Packit Service 82fcde
#	rpc_commondata.c -> rpc_common.c
Packit Service 82fcde
#	rpc_dtablesize.c -> rpc_dtable.c
Packit Service 82fcde
#	svc_auth_unix.c -> svc_authux.c
Packit Service 82fcde
#	xdr_reference.c -> xdr_ref.c
Packit Service 82fcde
Packit Service 82fcde
rpcsvc = bootparam_prot.x nlm_prot.x rstat.x \
Packit Service 82fcde
	 yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
Packit Service 82fcde
	 rusers.x spray.x nfs_prot.x rquota.x key_prot.x
Packit Service 82fcde
headers-sunrpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
Packit Service 82fcde
				  pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h \
Packit Service 82fcde
				  svc.h svc_auth.h types.h xdr.h auth_des.h \
Packit Service 82fcde
				  key_prot.h) \
Packit Service 82fcde
		       $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
Packit Service 82fcde
headers = rpc/netdb.h
Packit Service 82fcde
install-others = $(inst_sysconfdir)/rpc
Packit Service 82fcde
generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
Packit Service 82fcde
	     $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
Packit Service 82fcde
generated-dirs += rpcsvc
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(link-obsolete-rpc),yes)
Packit Service 82fcde
headers += $(headers-sunrpc)
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(build-shared),yes)
Packit Service 82fcde
need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
Packit Service 82fcde
			clnt_udp get_myaddr key_call netname pm_getport \
Packit Service 82fcde
			rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
Packit Service 82fcde
			xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
Packit Service 82fcde
			svc_run
Packit Service 82fcde
Packit Service 82fcde
routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
Packit Service 82fcde
	    rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
Packit Service 82fcde
	    pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
Packit Service 82fcde
	    svc_simple xdr_float xdr_rec publickey authdes_prot \
Packit Service 82fcde
	    des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
Packit Service 82fcde
	    getrpcent getrpcbyname getrpcbynumber \
Packit Service 82fcde
	    getrpcent_r getrpcbyname_r getrpcbynumber_r \
Packit Service 82fcde
	    clnt_unix svc_unix create_xid $(need-export-routines) \
Packit Service 82fcde
	    rpc_gethostbyname
Packit Service 82fcde
ifneq ($(link-obsolete-rpc),yes)
Packit Service 82fcde
# We only add the RPC for compatibility to libc.so.
Packit Service 82fcde
shared-only-routines = $(routines)
Packit Service 82fcde
endif
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(link-obsolete-rpc),yes)
Packit Service 82fcde
install-bin := rpcgen
Packit Service 82fcde
rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
Packit Service 82fcde
	      rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
Packit Service 82fcde
	      rpc_tblout.o rpc_sample.o
Packit Service 82fcde
extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
Packit Service 82fcde
others += rpcgen
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
Packit Service 82fcde
  tst-udp-nonblocking
Packit Service 82fcde
xtests := tst-getmyaddr
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(have-thread-library),yes)
Packit Service 82fcde
xtests += thrsvc
Packit Service 82fcde
tests += tst-udp-garbage
Packit Service 82fcde
tests-internal += tst-svc_register
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
ifeq ($(link-obsolete-rpc),yes)
Packit Service 82fcde
rpcgen-tests := $(objpfx)bug20790.out
Packit Service 82fcde
tests-special += $(rpcgen-tests)
Packit Service 82fcde
endif
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(link-obsolete-rpc),yes)
Packit Service 82fcde
headers += $(rpcsvc:%.x=rpcsvc/%.h)
Packit Service 82fcde
extra-libs := librpcsvc
Packit Service 82fcde
extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
Packit Service 82fcde
librpcsvc-routines = $(rpcsvc:%.x=x%)
Packit Service 82fcde
librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
Packit Service 82fcde
omit-deps = $(librpcsvc-routines)
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq (yes,$(build-shared))
Packit Service 82fcde
rpc-compat-routines = $(addprefix compat-,$(need-export-routines))
Packit Service 82fcde
rpc-compat-routines.os = $(addprefix $(objpfx), \
Packit Service 82fcde
				     $(addsuffix .os,$(rpc-compat-routines)))
Packit Service 82fcde
extra-objs += $(addsuffix .os,$(rpc-compat-routines))
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
include ../Rules
Packit Service 82fcde
Packit Service 82fcde
ifeq (yes,$(build-shared))
Packit Service 82fcde
subdir_lib: $(objpfx)librpc_compat_pic.a
Packit Service 82fcde
$(objpfx)librpc_compat_pic.a: $(rpc-compat-routines.os)
Packit Service 82fcde
	$(AR) cr$(verbose) $@ $^
Packit Service 82fcde
$(rpc-compat-routines.os): $(objpfx)compat-%.os: %.c $(before-compile)
Packit Service 82fcde
	$(compile-command.c) -DEXPORT_RPC_SYMBOLS
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
CFLAGS-xbootparam_prot.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xnlm_prot.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xrstat.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xyppasswd.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xklm_prot.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xrex.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xsm_inter.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xmount.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xrusers.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xspray.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xnfs_prot.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xrquota.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-xkey_prot.c += -Wno-unused $(PIC-ccflag)
Packit Service 82fcde
CFLAGS-auth_unix.c += -fexceptions
Packit Service 82fcde
CFLAGS-key_call.c += -fexceptions
Packit Service 82fcde
CFLAGS-pmap_rmt.c += -fexceptions
Packit Service 82fcde
CFLAGS-clnt_perr.c += -fexceptions
Packit Service 82fcde
CFLAGS-openchild.c += -fexceptions
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
Packit Service 82fcde
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
Packit Service 82fcde
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
Packit Service 82fcde
$(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so
Packit Service 82fcde
$(objpfx)tst-svc_register: \
Packit Service 82fcde
  $(common-objpfx)linkobj/libc.so $(shared-thread-library)
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs))
Packit Service 82fcde
Packit Service 82fcde
cross-rpcgen-objs := $(addprefix $(objpfx)cross-,$(rpcgen-objs))
Packit Service 82fcde
Packit Service 82fcde
# When generic makefile support for build system programs is
Packit Service 82fcde
# available, it should replace this code.  See
Packit Service 82fcde
# <https://sourceware.org/bugzilla/show_bug.cgi?id=14087>.
Packit Service 82fcde
$(cross-rpcgen-objs): $(objpfx)cross-%.o: %.c $(before-compile)
Packit Service 82fcde
	$(BUILD_CC) $($(basename $(
Packit Service 82fcde
		$(OUTPUT_OPTION) $(native-compile-mkdep-flags) -c
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)cross-rpcgen: $(cross-rpcgen-objs)
Packit Service 82fcde
	$(BUILD_CC) $^ $(BUILD_LDFLAGS) -o $@
Packit Service 82fcde
Packit Service 82fcde
# This makes sure -DIN_MODULE is passed for all these modules.
Packit Service 82fcde
cpp-srcs-left := $(rpcgen-objs:.o=.c)
Packit Service 82fcde
lib := nonlib
Packit Service 82fcde
include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
Packit Service 82fcde
Packit Service 82fcde
# How we run rpcgen to generate sources and headers in the rules below.
Packit Service 82fcde
# Setting CPP tells it how to run the C preprocessor correctly.  Note
Packit Service 82fcde
# that $(built-program-file) requires that the just-built cross-rpcgen
Packit Service 82fcde
# binary be the second dependency listed in each rule using rpcgen-cmd.
Packit Service 82fcde
rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-file) -Y ../scripts
Packit Service 82fcde
Packit Service 82fcde
# Install the rpc data base file.
Packit Service 82fcde
$(inst_sysconfdir)/rpc: etc.rpc $(+force)
Packit Service 82fcde
	$(do-install)
Packit Service 82fcde

Packit Service 82fcde
# Generate the rpcsvc headers with rpcgen.
Packit Service 82fcde
# We use a stamp file to avoid unnessary recompilation each time rpcgen is
Packit Service 82fcde
# relinked.
Packit Service 82fcde
$(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
Packit Service 82fcde
	@:
Packit Service 82fcde
$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen
Packit Service 82fcde
	$(make-target-directory)
Packit Service 82fcde
	-@rm -f ${@:stmp=T} $@
Packit Service 82fcde
	$(rpcgen-cmd) -h $< -o ${@:stmp=T}
Packit Service 82fcde
	$(move-if-change) $(@:stmp=T) $(@:stmp=h)
Packit Service 82fcde
	touch $@
Packit Service 82fcde
Packit Service 82fcde
# Generate the rpcsvc XDR functions with rpcgen.
Packit Service 82fcde
$(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
Packit Service 82fcde
	@:
Packit Service 82fcde
$(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen
Packit Service 82fcde
	-@rm -f ${@:stmp=T} $@
Packit Service 82fcde
	$(rpcgen-cmd) -c $< -o ${@:stmp=T}
Packit Service 82fcde
	$(move-if-change) $(@:stmp=T) $(@:stmp=c)
Packit Service 82fcde
	touch $@
Packit Service 82fcde
Packit Service 82fcde
# The generated source files depend on the corresponding generated headers.
Packit Service 82fcde
# Gratuitous dependency on generated .c file here just gets it mentioned to
Packit Service 82fcde
# avoid being an intermediate file and getting removed.
Packit Service 82fcde
define o-iterator-doit
Packit Service 82fcde
$(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
Packit Service 82fcde
endef
Packit Service 82fcde
object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes))
Packit Service 82fcde
include $(o-iterator)
Packit Service 82fcde
Packit Service 82fcde
rpcsvc-dt-files := $(foreach o,$(filter-out $(librpcsvc-inhibit-o),\
Packit Service 82fcde
					    $(object-suffixes)),\
Packit Service 82fcde
			     $(rpcsvc:%.x=$(objpfx)x%$o.dt))
Packit Service 82fcde
rpcsvc-depfiles := $(patsubst %.dt,%.d,$(wildcard $(rpcsvc-dt-files))) \
Packit Service 82fcde
		   $(wildcard $(rpcsvc-dt-files:.dt=.d))
Packit Service 82fcde
ifdef rpcsvc-depfiles
Packit Service 82fcde
ifneq ($(no_deps),t)
Packit Service 82fcde
-include $(rpcsvc-depfiles)
Packit Service 82fcde
endif
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
$(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen
Packit Service 82fcde
	-rm -f $@
Packit Service 82fcde
	$(built-program-cmd) -c $< -o $@; \
Packit Service 82fcde
	$(evaluate-test)
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so
Packit Service 82fcde
$(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
Packit Service 82fcde
$(objpfx)tst-udp-garbage: \
Packit Service 82fcde
  $(common-objpfx)linkobj/libc.so $(shared-thread-library)