From 247b71e690708a529cf639e196815cbbbee077d7 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 13 Mar 2016 15:59:12 -0400 Subject: [PATCH] * main.c(main): Disable output sync without parallel builds. --- main.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 62ed7a8a..22af6011 100644 --- a/main.c +++ b/main.c @@ -1464,13 +1464,6 @@ main (int argc, char **argv, char **envp) decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS")); - /* In output sync mode we need to sync any output generated by reading the - makefiles, such as in $(info ...) or stderr from $(shell ...) etc. */ - - syncing = make_sync.syncout = (output_sync == OUTPUT_SYNC_LINE - || output_sync == OUTPUT_SYNC_TARGET); - OUTPUT_SET (&make_sync); - #if 0 /* People write things like: MFLAGS="CC=gcc -pipe" "CFLAGS=-g" @@ -1478,6 +1471,13 @@ main (int argc, char **argv, char **envp) decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS")); #endif + /* In output sync mode we need to sync any output generated by reading the + makefiles, such as in $(info ...) or stderr from $(shell ...) etc. */ + + syncing = make_sync.syncout = (output_sync == OUTPUT_SYNC_LINE + || output_sync == OUTPUT_SYNC_TARGET); + OUTPUT_SET (&make_sync); + decode_switches (argc, (const char **)argv, 0); /* Set a variable specifying whether stdout/stdin is hooked to a TTY. */ @@ -2053,6 +2053,17 @@ main (int argc, char **argv, char **envp) } #endif + /* If we're not using parallel jobs, then we don't need output sync. + This is so people can enable output sync in GNUMAKEFLAGS or similar, but + not have it take effect unless parallel builds are enabled. */ + if (syncing && job_slots == 1) + { + OUTPUT_UNSET (); + output_close (&make_sync); + syncing = 0; + output_sync = OUTPUT_SYNC_NONE; + } + #ifndef MAKE_SYMLINKS if (check_symlink_flag) {