[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Put GNU build system files in a subdirectory?

From: Gavin Smith
Subject: Re: Put GNU build system files in a subdirectory?
Date: Fri, 17 May 2013 11:58:03 +0100

On Mon, Apr 29, 2013 at 8:16 PM, Bob Rossi <address@hidden> 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
>     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 out to the top-level, or
specify AC_CONFIG_FILES([Makefile:Automake/]) in

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

With the second option, "cd Automake && autoconf" works (as autoconf
does not seem to check for the existence of any files mentioned in 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, 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,} . && automake && rm
{aclocal.m4,}". (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/" and derive
the name of its own input file as "Automake/". You see it
is natural for 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 (e.g.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]