automake
[Top][All Lists]
Advanced

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

Re: Need help with cleaning up a working GNU Autotools setup


From: Ralf Wildenhues
Subject: Re: Need help with cleaning up a working GNU Autotools setup
Date: Sun, 9 Oct 2005 08:35:56 +0200
User-agent: Mutt/1.5.9i

Hi Sune,

* Sune Ahlgren wrote on Sat, Oct 08, 2005 at 09:27:01PM CEST:
>
> At this point all object files, binaries and libraries end up in the
> same directory as the source code from which they are created. This
> means a mess and I would want something like this:
> 
>                                         +----bin (for executables)
> rsd-----+----collections-+----obj (for intermediate object files)
>             |                           +----lib (for libraries)
>            +----debug  (as for collections)
>             |
>            +----global (as for collections)
> 
> How do I achieve this in a smooth way? I've tried the manuals and the
> net without being any wiser, so please, any hint is appreciated. I
> program in C, by the way.

With the Autotools, the habit is a bit different, but once you get used
to it, you'll see it has more advantages:

You have different trees:
- the source tree: that's where all hand-created and most
  autotools-created files go,
- the build tree: that's where all built objects, libraries,
  executables, and all output of `configure' goes,
- the install tree: that's where the to-be-installed files will live
  afterwards

You specify the second by running `configure' from it; for example:

cd rsd/..
mkdir build
cd build
../rsd/configure [OPTIONS]
make
make install

You specify the third by the option `--prefix' to configure. It defaults
to /usr/local, and several other variables allow finer-grained
distinctions.

The concept of different source and object trees allows, e.g., for one
object tree with debug flags (CFLAGS='-g' or so), or one tree per target
architecture, whatever.

If you then decide to use less than one Makefile.am per directory, you
might want to check out the Automake option `subdir-objects' to specify
where in the build tree your objects will live; but my guess is you can
worry about this later.

Automake and Autoconf documentation has much more information on all of
this.

Cheers,
Ralf




reply via email to

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