On Mon, Apr 29, 2013 at 8:16 PM, Bob Rossi <b...@brasko.net> wrote: > > Autotools is a great build system. However, after configuring it to > place as many files as possible in a subdirectory, it still takes up > 87.5% of my projects root directory. > > aclocal.m4 > autom4te.cache > build > configure > configure.ac > Makefile.am > Makefile.in > src <- This is my project >
I too dislike all the files in the top-level directory created or used by the build system. It seems that changing this would require changes to automake, autoconf, or both. If it is possible at present (it probably isn't), it would require messy workarounds. Suppose you place all files in a subdirectory ("Automake"), except Makefile and configure, which are all that a package user will use. Then you also have to pull Makefile.in out to the top-level, or specify AC_CONFIG_FILES([Makefile:Automake/Makefile.in]) in configure.ac. Creating Makefile in the Automake subdirectory wouldn't work, because it would be looking for all the source files in there, i.e. configure will set srcdir=Automake instead of srcdir=.. in the generated Makefile. With the second option, "cd Automake && autoconf" works (as autoconf does not seem to check for the existence of any files mentioned in configure.ac in the source tree), but you also have to "cp Automake/configure .", as the autoconf-generated configure script relies on being located in the top-level source directory. (Moving configure and running it with the --srcdir option does not work: it contains references to itself as "$(srcdir)/configure".) This breaks running automake though. It checks for the existence of some files mentioned in configure.ac, and their paths are relative to the top-level directory, not the Automake subdirectory. So the ugly workaround is, from the top-level directory, "cp Automake/{aclocal.m4,configure.ac} . && automake && rm {aclocal.m4,configure.ac}". (You'd also have to clean up the autom4te.cache directory that automake creates.) automake will see the input file for configure is called "Automake/Makefile.in" and derive the name of its own input file as "Automake/Makefile.am". You see it is natural for configure.ac and aclocal.m4 to be in the top-level directory, as automake needs to read them both. make dist is broken after this, because it still looks for aclocal.m4 in the top-level (and probably for other reasons as well). So it is not straightforward to move files to a subdirectory. You find that you have to have one of them in the top-level directory, and that in turn leads to others having to be in the top-level directory too. It might be possible to add an option to automake so you could do something like "automake --auxdir Automake" (run from the top level) to tell it where to look for its input files. This still wouldn't fix the verbose lines needed in configure.ac (e.g. "AC_CONFIG_FILES([Makefile:Automake/Makefile.in])").