I have a directory /src containing all of my source files, and /bin to store all binary after running make command. The directory is something like below:
/BuildDirectory
- - /src
- - /bin
- - configure
- - Makefile.am
- - configure.ac
- - ...
Now in Makefile.am, I have to specified:
bin_PROGRAMS = bin/x bin/y bin/z bin/k ...
bin_x_SOURCES = src/x.cpp
bin_y_SOURCES = src/y.cpp
bin_z_SOURCES = src/z.cpp
Is there any variable that can help to get rid of all "bin/" and "src/" ? For example I just specify:
$BIN = bin
$SRC = src
And they will look for the correct files in correct folders and compile it to the correct places.
Thanks
You could take advantage of remote building. Place this makefile in the bin dir:
Now replace the current Makefile.am with this one:
Now tweak your configure.ac to also generate bin/Makefile
and you should be set for life.
If what you're trying to do is what I think you're trying to do, you're trying to achieve something like:
I've tested this a few times in various forms, and it won't compile the code as it would with your example; I somehow convinced it that it was compiling C at one stage:
I'm thus fairly certain that it's not possible. Sorry.
Not to my knowledge. If you're looking to separate your compiled files from your source files, remember that you can build outside of the tree:
If this is what you're looking to do, you can make the
Makefile.am
simpler by creating binaries without a directory prefix (and still referencing things insrc/
by hand).