[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
21.2 Standard and generic ways to silence make
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 its serious limitations too. First of all, it embodies an “all or nothing” strategy, i.e., either everything is silenced, or nothing is; this lack of granularity can sometimes be a fatal flaw. Moreover, when the ‘-s’ flag is used, the
make
output might turn out to be too much 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 semantic of themake
calls — things these which 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, GNUmake
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-nestedmake
recursion.As an aside, notice that the ‘--no-print-directory’ option is automatically activated if the ‘-s’ flag is used.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 25, 2014 using texi2html 5.0.