1
2
3
4
5
6
|
<h1 class="section">Synchronized Terminal Output</h1> <p>Normally GNU <code>make</code> will invoke all commands with access to the same standard and error outputs that <code>make</code> itself was started with. A number of tools will detect whether the output is a terminal or not-a-terminal, and use this information to change the output style. For example if the output goes to a terminal the tool may add control characters that set color, or even change the location of the cursor. If the output is not going to a terminal then these special control characters are not emitted so that they don’t corrupt log files, etc. </p> <p>The <code>--output-sync</code> (see <a href="parallel-output">Output During Parallel Execution</a>) option will defeat the terminal detection. When output synchronization is enabled GNU <code>make</code> arranges for all command output to be written to a file, so that its output can be written as a block without interference from other commands. This means that all tools invoked by <code>make</code> will believe that their output is not going to be displayed on a terminal, even when it will be (because <code>make</code> will display it there after the command is completed). </p> <p>In order to facilitate tools which would like to determine whether or not their output will be displayed on a terminal, GNU <code>make</code> will set the <code>MAKE_TERMOUT</code> and <code>MAKE_TERMERR</code> environment variables before invoking any commands. Tools which would like to determine whether standard or error output (respectively) will be displayed on a terminal can check these environment variables to determine if they exist and contain a non-empty value. If so the tool can assume that the output will (eventually) be displayed on a terminal. If the variables are not set or have an empty value, then the tool should fall back to its normal methods of detecting whether output is going to a terminal or not. </p> <p>The content of the variables can be parsed to determine the type of terminal which will be used to display the output. </p> <p>Similarly, environments which invoke <code>make</code> and would like to capture the output and eventually display it on a terminal (or some display which can interpret terminal control characters) can set these variables before invoking <code>make</code>. GNU <code>make</code> will not modify these environment variables if they already exist when it starts. </p><div class="_attribution">
<p class="_attribution-p">
Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Free Software Foundation, Inc. <br>Licensed under the GNU Free Documentation License.<br>
<a href="https://www.gnu.org/software/make/manual/html_node/Terminal-Output.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Terminal-Output.html</a>
</p>
</div>
|