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