automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using automake for building cross development tools


From: Martin Koegler
Subject: Using automake for building cross development tools
Date: Thu, 6 Jan 2005 15:45:06 +0100
User-agent: Mutt/1.5.6+20040722i

I want to build with automake cross development tools, for which I
need normal programs for the host computer, but also sources compiled
for the real target. The target libraries should be installed along
with binutils and gcc configured for the target on the host system.

The target libraries are not useable for other platforms, so creating
an extra project, which is configured with --target=xx-xx, is
unnecessary complex. The target has so few resources, that it is not
possible to compile something on it.

As far as I can see, there is no support for such a project in
automake.

For finding a cross compiler, there is no support in autoconf.

My current solution is:
configure.in:
AC_PATH_PROG(TAS,[m68hc05-as],,[$PATH:$bindir:$prefix/bin])
AC_PATH_PROG(TLD,[m68hc05-ld],,[$PATH:$bindir:$prefix/bin])
AC_PATH_PROG(TAR,[m68hc05-ar],,[$PATH:$bindir:$prefix/bin])
AC_PATH_PROG(TRANLIB,[m68hc05-ranlib],,[$PATH:$bindir:$prefix/bin])
AC_PATH_PROG(TGCC,[m68hc05-gcc],,[$PATH:$bindir:$prefix/bin])

test -z "$TAS" && AC_MSG_ERROR([m68hc05-as not found])
test -z "$TAR" && AC_MSG_ERROR([m68hc05-ar not found])
test -z "$TLD" && AC_MSG_ERROR([m68hc05-ld not found])
test -z "$TRANLIB" && AC_MSG_ERROR([m68hc05 ranlib not found])
test -z "$TGCC" && AC_MSG_ERROR([m68hc05 gcc not found])

AC_PATH_PROG seems to be the only way to find a tool, if it is
installed in the path and has a fixed name. If the tool is not in the
path, or the tools are only available without the prefix in a
directory for the target (eg. $prefix/$target/bin), the workaround
with AC_PATH_PROG will not work.

Compiling for the target with the means of automake, which provide a
lot of services, is also not possible.

As a workaround, I move the target libraries in a separate directory
and overwrite there the path to the tools.

Makefile.am:
address@hidden@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
address@hidden@

target_alias=m68hc05
tooldir=$(exec_prefix)/$(target_alias)
tlibdir=$(tooldir)/lib

tlib_LIBRARIES=libx.a 

This works, because the gcc for the host has the same front-end as the
gcc for the target. The disadvantage is that compiler options
determined for the host computer are also passed to the target
compiler.

For installing files in ($prefix/$target/[lib,include,bin]), there
seems to be no automatic way to find appropriate directory.  Using
$(exec_prefix)/$(target_alias) as base works only, if the same prefix
is used for compiling the binutils/gcc and my libraries.

Is the a better way, to solve this problem?

mfg Martin Kögler
address@hidden
http://www.auto.tuwien.ac.at/~mkoegler/

PS: Please CC me in replies.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]