Normally GNU make
will invoke all commands with access to the same standard and error outputs that make
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.
The --output-sync
(see Output During Parallel Output) option will defeat the terminal detection. When output synchronization is enabled GNU make
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 make
will believe that their output is not going to be displayed on a terminal, even when it will be (because make
will display it there after the command is completed).
In order to facilitate tools which would like to determine whether or not their output will be displayed on a terminal, GNU make
will set the MAKE_TERMOUT
and MAKE_TERMERR
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.
The content of the variables can be parsed to determine the type of terminal which will be used to display the output.
Similarly, environments which invoke make
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 make
. GNU make
will not modify these environment variables if they already exist when it starts.
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 Free Software Foundation, Inc.
Licensed under the GNU Free Documentation License.
https://www.gnu.org/software/make/manual/html_node/Terminal-Output.html