Automake generating binaries to bin/ instead of in src/

autoconfautomakeautotools

I searched for the answer to this question but couldn't find any good. Maybe they're old and something has changed, so I ask again.

I have a directory structure as:

my_project

  • src

  • bin

I want that, when I do make in the root dir, the binaries are put in ./bin, instead of cluttering ./src. But how?

EDIT: I am using C++. My Makefile.am has nothing special. Just the bin_PROGRAM and _SOURCES variables.

When I run make, the binaries generated are put into ./src. I simply want them in ./bin.

Best Answer

You've got the wrong idea here.

Your build tree is wherever you run configure. That's how autoconf is designed to work. Users of your package (who do not want to clutter their source tree) will expect it to work this way.

This approach is a more general solution with a lot more flexibility than the organization you're imagining. For instance, it's not terribly unusual to want to maintain sources and build files on separate filesystems.

Related Topic