This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Build rpcgen-generated files when cross compiling


> +$(addprefix $(objpfx)cross-,$(rpcgen-objs)): $(objpfx)cross-%.o: %.c
> +	$(make-target-directory)
> +	$(BUILD_CC) $< -c -D_GNU_SOURCE -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ \
> +		$(OUTPUT_OPTION) $(compile-mkdep-flags)
> +
> +$(objpfx)cross-rpcgen: $(addprefix $(objpfx)cross-,$(rpcgen-objs))
> +	$(BUILD_CC) $^ -o $@

Use something like:

	cross-rpcgen-objs = $(addprefix $(objpfx)cross-,$(rpcgen-objs))

to avoid repeating the hairball.

> -rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
> +rpcgen-cmd = CPP='$(CC) -E -x c-header' $(objpfx)cross-rpcgen -Y ../scripts

As Andreas pointed out, $(built-program-file) dtrt here.

Overall, I like this direction.  It seems worthwhile to genericize it a
little with vars/rules in Makerules to cover other future cases too.  I can
try to come up with some general variables/rules if it's not obvious to you
what I have in mind.

You should use BUILD_CPPFLAGS, BUILD_CFLAGS, BUILD_LDFLAGS.

sunrpc/Makefile can do:

	sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_
	CPPFLAGS += $(sunrpc-CPPLAGS)
	BUILT_CPPFLAGS += $(sunrpc-CPPLAGS)

Rather than _CROSS_RPCGEN_ I'd prefer something generic like IS_IN_build,
which a generic BUILD_CC-using variable (build-compile-command.c perhaps)
can use.


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]