By default, the Gnulib import directory will contain a generated
Makefile.am file. After configuring, this produces a generated
Makefile in this directory. As a consequence, the build from the
top-level directory will use a recursive make invocation for this
directory.
Some people prefer a build system where the Makefile in the
top-level directory directly builds the artifacts in the subdirectories,
without an intermediate make invocation. This is called
“non-recursive make” and is supported by Automake. For more details,
see https://autotools.io/automake/nonrecursive.html.
Gnulib supports this flavour of build system too. To use it, pass two
options to gnulib-tool: ‘--makefile-name’ and
‘--automake-subdir’.
With the gnulib-tool option ‘--makefile-name’, you are
telling gnulib-tool to generate an includable Makefile.am
portion in the Gnulib import directory, rather than a self-contained
Makefile.am. For example, when you use
‘--makefile-name=Makefile.gnulib’, gnulib-tool will generate
Makefile.gnulib.
With the option ‘--automake-subdir’, you are telling
gnulib-tool that you will include the generated file from the
Makefile.am in the top-level directory, rather than from a
Makefile.am in the same directory. For example, the top-level
Makefile.am might contain this directive:
include lib/Makefile.gnulib
The option ‘--automake-subdir’ is also supported in combination
with ‘--with-tests’ (see Bundling the unit tests of the Gnulib modules). Note that in this case,
however, the generated unit tests directory will contains a
Makefile.am and thus use a recursive make invocation.
This is not a problem, since the built artifacts of your package have
no dependencies towards the Gnulib unit tests, nor vice versa.