make: Parallel Output

1 
1 5.4.1 Output During Parallel Execution
1 --------------------------------------
1 
1 When running several recipes in parallel the output from each recipe
1 appears as soon as it is generated, with the result that messages from
1 different recipes may be interspersed, sometimes even appearing on the
1 same line.  This can make reading the output very difficult.
1 
1    To avoid this you can use the '--output-sync' ('-O') option.  This
1 option instructs 'make' to save the output from the commands it invokes
1 and print it all once the commands are completed.  Additionally, if
1 there are multiple recursive 'make' invocations running in parallel,
1 they will communicate so that only one of them is generating output at a
1 time.
1 
11    If working directory printing is enabled (⇒The
 '--print-directory' Option -w Option.), the enter/leave messages are
1 printed around each output grouping.  If you prefer not to see these
1 messages add the '--no-print-directory' option to 'MAKEFLAGS'.
1 
1    There are four levels of granularity when synchronizing output,
1 specified by giving an argument to the option (e.g., '-Oline' or
1 '--output-sync=recurse').
1 
1 'none'
1      This is the default: all output is sent directly as it is generated
1      and no synchronization is performed.
1 
1 'line'
1      Output from each individual line of the recipe is grouped and
1      printed as soon as that line is complete.  If a recipe consists of
1      multiple lines, they may be interspersed with lines from other
1      recipes.
1 
1 'target'
1      Output from the entire recipe for each target is grouped and
1      printed once the target is complete.  This is the default if the
1      '--output-sync' or '-O' option is given with no argument.
1 
1 'recurse'
1      Output from each recursive invocation of 'make' is grouped and
1      printed once the recursive invocation is complete.
1 
1    Regardless of the mode chosen, the total build time will be the same.
1 The only difference is in how the output appears.
1 
1    The 'target' and 'recurse' modes both collect the output of the
1 entire recipe of a target and display it uninterrupted when the recipe
1 completes.  The difference between them is in how recipes that contain
11 recursive invocations of 'make' are treated (⇒Recursive Use of
 'make' Recursion.).  For all recipes which have no recursive lines, the
1 'target' and 'recurse' modes behave identically.
1 
1    If the 'recurse' mode is chosen, recipes that contain recursive
1 'make' invocations are treated the same as other targets: the output
1 from the recipe, including the output from the recursive 'make', is
1 saved and printed after the entire recipe is complete.  This ensures
1 output from all the targets built by a given recursive 'make' instance
1 are grouped together, which may make the output easier to understand.
1 However it also leads to long periods of time during the build where no
1 output is seen, followed by large bursts of output.  If you are not
1 watching the build as it proceeds, but instead viewing a log of the
1 build after the fact, this may be the best option for you.
1 
1    If you are watching the output, the long gaps of quiet during the
1 build can be frustrating.  The 'target' output synchronization mode
1 detects when 'make' is going to be invoked recursively, using the
1 standard methods, and it will not synchronize the output of those lines.
1 The recursive 'make' will perform the synchronization for its targets
1 and the output from each will be displayed immediately when it
1 completes.  Be aware that output from recursive lines of the recipe are
1 not synchronized (for example if the recursive line prints a message
1 before running 'make', that message will not be synchronized).
1 
1    The 'line' mode can be useful for front-ends that are watching the
1 output of 'make' to track when recipes are started and completed.
1 
1    Some programs invoked by 'make' may behave differently if they
1 determine they're writing output to a terminal versus a file (often
1 described as "interactive" vs.  "non-interactive" modes).  For example,
1 many programs that can display colorized output will not do so if they
1 determine they are not writing to a terminal.  If your makefile invokes
1 a program like this then using the output synchronization options will
1 cause the program to believe it's running in "non-interactive" mode even
1 though the output will ultimately go to the terminal.
1