On Wed, 2024-10-30 at 11:07 -0400, David A. Wheeler wrote:
> However, I *do* think having a standard way to *request* output
> interleaving in make would make sense in POSIX. I would suggest using
> the GNU Make one-letter option "-O" (aka "--output-sync"). Make it
> clear that adding "-O" to MAKEFLAGS would give output interleaving,
> and you have the capability.

That's fine with me, although implementing this is not completely
trivial since the "I own stdout" token needs to be shared between
recursive instances of make.

Note that GNU Make supports multiple styles of output sync.  It may be
interesting to read:
https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
because there are some subtleties to consider.

Also note that GNU Make exports two environment variables: MAKE_TERMOUT
and MAKE_TERMERR.  These values allow commands that test whether
stdout/stderr is a terminal, to work properly in the face of
synchronized output.  For example, if your compiler generates colorized
error/warning messages when printing to stdout but not when printing to
a file, then enabling synchronized output will disable all colorized
output.  Tools that generate colorized output can be enhanced to check
for these variables in addition to isatty() (or whatever) to be
notified that the output generated will ultimately appear on a
terminal, even if stdout is not currently connected to one.

Info here:
https://www.gnu.org/software/make/manual/html_node/Special-Variables.html#index-MAKE_005fTERMOUT-_0028whether-stdout-is-a-terminal_0029

Obviously this requires changes to the tools GNU Make invokes, few of
which have adopted this behavior so far.

  • request: make [-j... Andrew via austin-group-l at The Open Group
    • Re: request:... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: request:... Rob Landley via austin-group-l at The Open Group
      • Re: requ... G. Branden Robinson via austin-group-l at The Open Group
      • Re: requ... Andrew via austin-group-l at The Open Group
        • Re: ... Paul Smith via austin-group-l at The Open Group
          • ... Andrew via austin-group-l at The Open Group
            • ... Paul Smith via austin-group-l at The Open Group
              • ... David A. Wheeler via austin-group-l at The Open Group
                • ... Paul Smith via austin-group-l at The Open Group
                • ... Steffen Nurpmeso via austin-group-l at The Open Group
        • Re: ... Rob Landley via austin-group-l at The Open Group
          • ... enh via austin-group-l at The Open Group
          • ... Paul Smith via austin-group-l at The Open Group
            • ... David A. Wheeler via austin-group-l at The Open Group
              • ... Steffen Nurpmeso via austin-group-l at The Open Group
              • ... Paul Smith via austin-group-l at The Open Group
                • ... Dmitry Goncharov via austin-group-l at The Open Group
      • Re: requ... Steffen Nurpmeso via austin-group-l at The Open Group
        • Re: ... Nick Stoughton via austin-group-l at The Open Group

Reply via email to