Here we describe some common idioms/tricks to obtain a quieter
make
output, with their relative advantages and drawbacks.
In the next section (How Automake can help in silencing Make) we’ll see how
Automake can help in this respect, providing more elaborate and
flexible idioms.
make -s
This simply causes make
not to print any rule before
executing it.
The -s flag is mandated by POSIX, universally supported, and its purpose and function are easy to understand.
But it also has serious limitations. First of all, it embodies an
“all or nothing” strategy, i.e., either everything is silenced, or
nothing is; in practice, this lack of granularity makes it unsuitable
as a general solution. When the -s flag is used, the
make
output might turn out to be too terse; in case of
errors, the user won’t be able to easily see what rule or command have
caused them, or even, in case of tools with poor error reporting, what
the errors were.
make >/dev/null || make
Apparently, this perfectly obeys the “silence is golden” rule: warnings from stderr are passed through, output reporting is done only in case of error, and in that case it should provide a verbose-enough report to allow an easy determination of the error location and causes.
However, calling make
two times in a row might hide errors
(especially intermittent ones), or subtly change the expected
semantics of the make
calls—these things can clearly make
debugging and error assessment very difficult.
make --no-print-directory
This is GNU make
specific. When called with the
--no-print-directory option, GNU make
will disable
printing of the working directory by invoked sub-make
s (the
well-known “Entering/Leaving directory …” messages). This
helps to decrease the verbosity of the output, but experience has
shown that it can also often render debugging considerably harder in
projects using deeply-nested make
recursion.
As an aside, the --no-print-directory option is automatically activated if the -s flag is used.