1
votes

I am using autotools with a tree that is composed of several different components of the same project with various libs that are shared between the differnet components. The intention is to have the components separated and built on different platforms w/ different architectures, but currently the entire project is a single tree and everything builds all at once for x86_64.

I'd like to be able to specifiy which component I'd like to make for the platform it will be run on, build, and install it. For example, in my thinking it might look something like the following:

$ cd componentA-BUILD
$ ../my-proj/configure --prefix=/install/A/here
$ make componentA
$ make install

The above should build componentA for x86_64 and install it in the location for which it was configured.

$ cd componentB-BUILD
$ ../my-proj/configure --prefix=/install/B/here
$ make componentB
$ make install

This should build componentB for ARM and install it in the prefix location for which it was configured (I haven't yet learned cross-compiling with autotools).

1
I am missing the question. The architecture for crossbuilding is usually passed as a configure parameter. see gnu.org/software/automake/manual/html_node/… - arved
Forget the cross-compiling, I'll take it step by step. The question is how to build specific components in a tree of many components. So if it contains component A, B, and C, how do I just build component A? The way I currently have it, is the entire tree builds. - Ender

1 Answers

1
votes

Although it is not perfectly what you are trying to achieve, my suggestion is to use the autoconf's variable $host (or $target, if you are cross-compiling).

For example add in your configure.ac the lines:

case $host in
  x86_64-*-linux-gnu*)
    COMPDIRS="componentA"
    AC_PREFIX_DEFAULT(/install/A/here)
  ;;
  i386-*-linux-gnu*)
    COMPDIRS="componentB componentC"
    AC_PREFIX_DEFAULT(/install/B/here)
  ;;
esac
AC_SUBST(COMPDIRS)

Also alter your SUBDIRS variable of root Makefile.am like:

SUBDIRS = $(COMPDIRS)

In the above example, the COMPDIR get different values depending to the host system. Then this variable is passed as the SUBDIRS definition.

Also you can use AC_PREFIX_DEFAULT according to each system.