[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [WISH] Local target in cross compialtion
From: |
Jezz |
Subject: |
Re: [WISH] Local target in cross compialtion |
Date: |
Thu, 8 Jun 2006 10:58:20 +0200 |
User-agent: |
KMail/1.9.1 |
Le Jeudi 8 Juin 2006 10:02, Ralf Wildenhues a écrit :
> 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).
Hmm... You should use "BUILD" when you use triplet build/host/target
(for exemple, when you compile a compiler). In this case, you have to
use "AC_CANONICAL_BUILD" directive in configure.ac.
In my case, I use "AC_CANONICAL_HOST" meaning I only use a pair
host/target. So I think "HOSTCC" is the good nomination.
But, in lines from configure.ac following, i have to use ${host_alias}
instead of ${build_alias} (which explains some errors during my
compilation).
> 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}
Error here : HOSTCC=${HOSTCC:=${host_alias}-gcc}
> > else
> > HOSTCC=${HOSTCC:=$CC}
> > fi
>
> That's pretty GCC-specific. But I guess that's ok for you.
I know :-( . Maybe there exist a better way to detect local compiler,
but I havn't found it.
> > 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? ;-)
sure.
This discution lead me to a question:
Why variables *_COMPILE and *_CC does not exist while there exist
variables *_LINK and *_CFLAGS? It shouldn't be very difficult to add,
and it should simplify problem of binaries for local host, no?
--
Jezz