diff options
author | Bruno Haible <bruno@clisp.org> | 2021-12-15 19:18:31 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2021-12-15 19:18:31 +0100 |
commit | b2bd0a9041ed7401fb69f59f7450abb8b3249ecb (patch) | |
tree | 328f2f82b7b367f9ba72f43589bc774f19ecc9f4 /doc/gnulib-tool.texi | |
parent | e3174b6d1fdbe6ea2297bf8c8333f65f9d9d9588 (diff) | |
download | gnulib-b2bd0a9041ed7401fb69f59f7450abb8b3249ecb.tar.gz |
Accommodate non-recursive Automake in a less hacky way.
* gnulib-tool: New option --automake-subdir.
(automake_subdir): New variable.
(func_emit_initmacro_end): Add a second argument. Use it to prefix each
object file name in *_LIBOBJS and *_LTLIBOBJS.
(func_emit_shellvars_init): New function.
(func_import): Add support for --automake-subdir. Invoke
prefix-gnulib-mk. Update calls to func_emit_initmacro_end. Call
func_emit_shellvars_init.
(func_create_testdir): Update calls to func_emit_initmacro_end. Call
func_emit_shellvars_init.
* m4/gnulib-tool.m4 (gl_AUTOMAKE_SUBDIR): New macro.
* m4/gnulib-common.m4 (gl_CONDITIONAL_HEADER): Use the value of the
gl_source_base_prefix variable.
* build-aux/prefix-gnulib-mk: New options --from-gnulib-tool, --prefix.
(contents_of_file): Renamed from contents.
(contents_of_stdin): New function.
(process): Inline and remove function.
* doc/gnulib-tool.texi (Non-recursive make): New section.
Diffstat (limited to 'doc/gnulib-tool.texi')
-rw-r--r-- | doc/gnulib-tool.texi | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/doc/gnulib-tool.texi b/doc/gnulib-tool.texi index 7f66c4248c..7e662cbcf9 100644 --- a/doc/gnulib-tool.texi +++ b/doc/gnulib-tool.texi @@ -46,6 +46,7 @@ a real run without changing anything. * Link-time requirements:: Which libraries to link against * Finding POSIX substitutes:: Determining additional suitable Gnulib modules * Modified build rules:: Modifying the build rules of a Gnulib import +* Non-recursive make:: Building directly from the top-level directory * Multiple instances:: Using Gnulib for both a library and a program * gettextize and autopoint:: Caveat: @code{gettextize} and @code{autopoint} users! * Localization:: Handling Gnulib's own message translations. @@ -601,6 +602,50 @@ The other approach, the kitchen-sink module, is more advanced. See chapter @ref{Extending Gnulib}. +@node Non-recursive make +@section Building directly from the top-level directory + +By default, the Gnulib import directory will contain a generated +@code{Makefile.am} file. After configuring, this produces a generated +@code{Makefile} in this directory. As a consequence, the build from the +top-level directory will use a recursive @code{make} invocation for this +directory. + +Some people prefer a build system where the @code{Makefile} in the +top-level directory directly builds the artifacts in the subdirectories, +without an intermediate @code{make} invocation. This is called +``non-recursive make'' and is supported by Automake. For more details, +see @url{https://autotools.io/automake/nonrecursive.html}. + +Gnulib supports this flavour of build system too. To use it, pass two +options to @code{gnulib-tool}: @samp{--makefile-name} and +@samp{--automake-subdir}. + +With the @code{gnulib-tool} option @samp{--makefile-name}, you are +telling @code{gnulib-tool} to generate an includable @code{Makefile.am} +portion in the Gnulib import directory, rather than a self-contained +@code{Makefile.am}. For example, when you use +@samp{--makefile-name=Makefile.gnulib}, @code{gnulib-tool} will generate +@code{Makefile.gnulib}. + +With the option @samp{--automake-subdir}, you are telling +@code{gnulib-tool} that you will include the generated file from the +@code{Makefile.am} in the top-level directory, rather than from a +@code{Makefile.am} in the same directory. For example, the top-level +@code{Makefile.am} might contain this directive: + +@smallexample +include lib/Makefile.gnulib +@end smallexample + +The option @samp{--automake-subdir} is also supported in combination +with @samp{--with-tests} (@pxref{Unit tests}). Note that in this case, +however, the generated unit tests directory will contains a +@code{Makefile.am} and thus use a recursive @code{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. + + @node Multiple instances @section Using Gnulib for both a library and a program |