tags:

views:

103

answers:

1

When I run my autotools-generated Makefile with "make" it generates the files in the current directory. I would prefer it to not "pollute" my directory but move the programs to "bin/" (since the source is in "src/")

Is this possible with autotools? (Using autoconf and automake - Not libtool)

+3  A: 
mkdir builddir
cd builddir
../foobar-1.2.3/configure --my --options   (or)
/path/to/foobar-1.2.3/configure --my --options
make
make foobar
make check
make install

What I usually end up whith when building manually is something like

cd foobar-1.2.3
(mkdir _b && cd _b && ../configure --prefix=$PWD/../_i)
make -C _b all check install installcheck
./_i/bin/foobar
vi foo.c bar.c foobar.h
gimp icons/foobar-moo.png
make -C _b install && ./_i/bin/foobar

Then I have the whole stuff related to the foobar program inside one directory foobar-1.2.3, including source code, built files, and a test installation.

The built files in foobar-1.2.3/_b are easily removed with rm -rf _b, and the test installation with rm -rf _i, in the course of editing the source tree from a shell with current working directory foobar-1.2.3.

Of course, you can use a variant of that and move the build/install dirs up one directory: foobar-1.2.3--b and foobar-1.2.3--i alongside foobar-1.2.3.

ndim
That looks good, and I will probably end up using this. But is there no simple way to redirect it by default?
mathepic
The make rules Automake creates can compile into the source directory tree and into a kind of "empty mirror" of the source directory tree. There is no third option.
ndim
Could you elaborate on that?
mathepic
ndim