I have a C project that has the following structure
Main/
Makefile.am
bin/
src/
Makefile.am
main.c
SomeLibrarySource/
SomeFuncs.c
SomeFuncs.h
The main.c contains the main function that uses functions defined in the SomeFuncs.{h/c} files.
I want to use autotools for this project. I read a couple of resources on autotools. But, I was only able to manage using autotools
for a single level project where all source, object and other files reside in the same directory.
Then I got some links that talked about using autotools for deep projects like this one and then I got confused.
Right now I have two Makefile.am as follows
Makefile.am
SUBDIRS=src
src/Makefile.am
mainprgdir=../
mainprg_PROGRAMS=main
main_SOURCES=main.c
I am pretty sure that these files should not be as I have them now :P
How do I use autotools for the above project structure? (At least what should be there in those Makefile.am
(s) and where should I place them.
EDIT: One more thing! At the end I would like to have the object files created in the bin directory.
Thanks
Makefile
at the root of the project. There can be other makefiles, but these are just included by the master one, and contribute to one big tree of dependencies. Do not callmake
as a command from withinMakefile
, in other words. - KazMakefile.am
. That is a template file forautomake
. You can use Autoconf without Automake. An approach that is not bad is to have aMakefile
which is not generated. The configurable make variables go into aconfig.make
(generated fromconfig.make.in
) and thatconfig.make
isinclude
-d fromMakefile
. If you must use autotools, keep it simple. - Kazbin/
directory is not writable. If you personally prefer them there, thencd bin && ../configure
, but don't force that preference on others. - ptomato