4

I've got a C++ project which uses automake and autoconf. I'm new to both of these.

My home directory is network mounted -- the same on every server we have -- and I want to compile and run the project (and its executable) concurrently on separate machines.

Our servers are frequently different architectures. My desktop is 32-bit, but the server is 64-bit, etc.

What options do I use in configure.ac and Makefile.am to compile the object files in separate directories named for the machine architectures? It's relatively simple to do this in a regular Makefile, but I don't know how to set autotools.

Translunar
  • 3,739
  • 33
  • 55

1 Answers1

9

If you don't do anything "wrong" or unusual in your configure.ac and Makefile.am setup, this is supported automatically:

mkdir /some/where/build
cd /some/where/build
/else/where/source/configure --options...
make
make install

Basically, you create the build directory anywhere you want (in your case probably on a non-network mount), and call configure from there. This will then build the code in the build directory you have created.

Peter Eisentraut
  • 35,221
  • 12
  • 85
  • 90
  • 4
    For more info about this, see the "VPATH Builds" section of the Automake manual. http://sources.redhat.com/automake/automake.html#VPATH-Builds – adl Jan 21 '10 at 12:41
  • I have a `src` directory which contains my `.cpp` and `.h` files. When I run `./configure` in the parent directory, the binary ends up in the `src` dir. Perhaps this is the sort of "wrong" configuration to which you allude? – Translunar Jan 21 '10 at 17:32
  • 1
    No, you need to create a completely separate directory for your build and then run configure from there. – Peter Eisentraut Jan 21 '10 at 20:17
  • is it possible to extend this so that even configure is inside /some/where/build? Specifically I need to generate the configure and the Makefile.in scripts, and I am using autogen.. I would like NOT to pollute my source dir with these either. – Rick Deckard Feb 14 '15 at 00:40