Traditionally, most unix-like systems have a length limitation for the
command line arguments and environment contents when creating new
processes (see for example
https://www.in-ulm.de/~mascheck/various/argmax/ for an
overview on this issue),
which of course also applies to commands spawned by make
.
POSIX requires this limit to be at least 4096 bytes, and most modern
systems have quite high limits (or are unlimited).
In order to create portable Makefiles that do not trip over these limits, it is necessary to keep the length of file lists bounded. Unfortunately, it is not possible to do so fully transparently within Automake, so your help may be needed. Typically, you can split long file lists manually and use different installation directory names for each list. For example,
data_DATA = file1 ... fileN fileN+1 ... file2N
may also be written as
data_DATA = file1 ... fileN data2dir = $(datadir) data2_DATA = fileN+1 ... file2N
and will cause Automake to treat the two lists separately during
make install
. See The Two Parts of Install for choosing
directory names that will keep the ordering of the two parts of
installation Note that make dist
may still only work on a host
with a higher length limit in this example.
Automake itself employs a couple of strategies to avoid long command
lines. For example, when ‘${srcdir}/’ is prepended to file
names, as can happen with above $(data_DATA)
lists, it limits
the amount of arguments passed to external commands.
Unfortunately, some systems’ make
commands may prepend
VPATH
prefixes like ‘${srcdir}/’ to file names from the
source tree automatically (see Automatic
Rule Rewriting in The Autoconf Manual). In this case, the user
may have to switch to use GNU Make, or refrain from using VPATH builds,
in order to stay below the length limit.
For libraries and programs built from many sources, convenience archives may be used as intermediates in order to limit the object list length (see Libtool Convenience Libraries).