[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [WISH] Local target in cross compialtion
From: |
Ralf Wildenhues |
Subject: |
Re: [WISH] Local target in cross compialtion |
Date: |
Thu, 8 Jun 2006 10:02:50 +0200 |
User-agent: |
Mutt/1.5.11 |
Hi Jérôme,
* Jérôme Pouiller wrote on Tue, Jun 06, 2006 at 06:52:50PM CEST:
>
> I have made research in automake documentation/ML, but, I have not found
> any solution to compile binary for local host (used, for exemple, to
> build some headers) in a project configured for cross compilation.
> The best solution I found is :
>
> data.h: $(genData_SOURCES)
> $(MAKE) $(AM_MAKEFLAGS) CC=$(HOSTCC) CCLD=$(HOSTCCLD) \
> CFLAGS="$(HOSTCFLAGS)" genData
Hmm. Not such a bad idea, I guess; except that I'd try to conform to
the Autoconf naming of build/host/target and use BUILDCC, or
CC_FOR_BUILD instead (I think GCC uses the latter).
Of course you have to assume that you don't need any configure tests
for BUILDCC, since you cannot use config.h (in general) for features of
$build. If you do, probably the cleanest way would be to have a
separate configure script to check $build features. (And you can't use
AC_CONFIG_SUBDIRS easily because you need to disable the cache file
passing.)
> HOSTCC, HOSTCCLD and HOSTCFLAGS are configured in configure.ac with:
>
> AC_CANONICAL_HOST
> [...]
> if test x$cross_compiling = xyes; then
> HOSTCC=${HOSTCC:=${build_alias}-gcc}
> else
> HOSTCC=${HOSTCC:=$CC}
> fi
That's pretty GCC-specific. But I guess that's ok for you.
> This seems to be the best way to compile local targets. It'd be really
> great if it would possible to do:
> HOST_PROGRAMS = genData
>
> At least, write the best method to use in documentation.
The best way would be to implement a more general framework for such
setups in Autoconf and Automake. And then document that. Seems like a
lot of work though ... any volunteers? ;-)
Cheers,
Ralf