From 28e725016266de6cc18f7aef5c675c57b7a42a89 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Thu, 10 May 2012 17:07:45 +0000 Subject: Build rpcgen-generated files when cross compiling. --- sunrpc/Makefile | 32 ++++++++++++++++++++++++-------- sunrpc/proto.h | 16 ++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) (limited to 'sunrpc') diff --git a/sunrpc/Makefile b/sunrpc/Makefile index b4548d5ccd..e61efd02b3 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -97,15 +97,12 @@ ifeq ($(have-thread-library),yes) xtests += thrsvc endif -ifeq (no,$(cross-compiling)) -# We can only build this library if we can run the rpcgen we build. headers += $(rpcsvc:%.x=rpcsvc/%.h) extra-libs := librpcsvc extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. librpcsvc-routines = $(rpcsvc:%.x=x%) librpcsvc-inhibit-o = .os # Build no shared rpcsvc library. omit-deps = $(librpcsvc-routines) -endif ifeq (yes,$(build-shared)) rpc-compat-routines = $(addprefix compat-,$(need-export-routines)) @@ -143,7 +140,9 @@ CFLAGS-pmap_rmt.c = -fexceptions CFLAGS-clnt_perr.c = -fexceptions CFLAGS-openchild.c = -fexceptions -CPPFLAGS += -D_RPC_THREAD_SAFE_ +sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_ +CPPFLAGS += $(sunrpc-CPPFLAGS) +BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS) $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so @@ -151,13 +150,30 @@ $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) +cross-rpcgen-objs := $(addprefix $(objpfx)cross-,$(rpcgen-objs)) +extra-objs += $(cross-rpcgen-objs) + +# When generic makefile support for build system programs is +# available, it should replace this code. See +# . +$(cross-rpcgen-objs): $(objpfx)cross-%.o: %.c + $(make-target-directory) + $(BUILD_CC) $($(basename $(