I've got application which uses Autotools (Autoconf, Automake etc) which builds object and binary files into project directory. It is not convenient, I'd like to have separate directory for them, e.g. "build" directory. I.e. I need "shadow build". Could anybody advise how this could be done?
The Autotools support out-of-source building by default, as described in the Automake manual. In a nutshell, you create a directory, anywhere, into which the build results should go. You make that your working directory, and run the project's configure
script from there:
mkdir ~/the_project-build
cd ~/the_project-build
~/the_project-1.2.3/configure
make
make install
All built files should then go into the build tree you've created instead of into the source tree. It is possible for the root of the build tree to be inside the project directory if you prefer.
Do be aware, however, that
This feature depends on Automake and Autoconf together. Projects that use Autoconf without Automake require some manual attention to make out-of-source building work for them, and in my experience, such projects often don't receive that attention.
There is a number of things the maintainers of an Autotools-based project can do to break out-of-source building, so you cannot be fully confident that every Autotools project can be built this way straight out of the box.
On the other hand, Automake automatically provides a 'distcheck' target that tests out-of-source building, among other things, so package maintainers have a tool intended to help ensure that their projects do support out-of-source builds. This improves the likelihood that any given project in fact does.