On 1/19/22 23:11, Paul Smith wrote:
I rewrote this function and applied this change:

Oh, that's much nicer than what I sent! Thanks.

I suggested working around the problem in the GNU Emacs Makefiles by installing the attached patch. It's a bit of a hack but I couldn't think of anything better, other than outputting the information with the shell rather than with $(info). I'm mentioning this here in case anyone else needs a workaround for current and older GNU Make.
From 153f3d9af2b3d021d9ba8eb17d979c772a7c09cd Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Thu, 20 Jan 2022 10:11:39 -0800
Subject: [PATCH] Work around GNU Make $(info) bug

Problem reported by Lars Ingebrigtsen (Bug#53358).
* src/verbose.mk.in (newline, info-trailing-newline): New macros.
(AM_V_AR, AM_V_CC, AM_V_CXX, AM_V_CCLD, AM_V_CXXLD, AM_V_ELC)
(AM_V_ELN, AM_V_GEN, AM_V_RC): Use them.
---
 src/verbose.mk.in | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/verbose.mk.in b/src/verbose.mk.in
index e3f5678303..4a3bbcb9de 100644
--- a/src/verbose.mk.in
+++ b/src/verbose.mk.in
@@ -17,6 +17,26 @@
 ## You should have received a copy of the GNU General Public License
 ## along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
+# Use two empty lines to define a macro containing a newline.
+define newline
+
+
+endef
+
+# Work around a bug in GNU Make 4.3 and earlier, which implements $(info MSG)
+# via two system calls { write (..., "MSG", 3); write (..., "\n", 1); }
+# which looks bad when make -j interleaves two of these at about the same time.
+# Later versions of GNU Make have the 'notintermediate' feature,
+# so assume that $(info ...) has the bug if this feature is absent.
+# The workaround arranges for 'MSG' itself to end in newline;
+# although this follows every message by an empty line,
+# that's better than the interleaved output.
+ifeq (,$(filter notintermediate,$(value .FEATURES)))
+info-trailing-newline = $(newline)
+else
+info-trailing-newline =
+endif
+
 # 'make' verbosity.
 V = @AM_DEFAULT_VERBOSITY@
 ifeq (${V},1)
@@ -33,26 +53,26 @@ AM_V_GLOBALS =
 AM_V_NO_PD =
 AM_V_RC =
 else
-AM_V_AR      = @$(info $   AR       $@)
+AM_V_AR      = @$(info $   AR       $@$(info-trailing-newline))
 AM_V_at = @
-AM_V_CC      = @$(info $   CC       $@)
-AM_V_CXX     = @$(info $   CXX      $@)
-AM_V_CCLD    = @$(info $   CCLD     $@)
-AM_V_CXXLD   = @$(info $   CXXLD    $@)
+AM_V_CC      = @$(info $   CC       $@$(info-trailing-newline))
+AM_V_CXX     = @$(info $   CXX      $@$(info-trailing-newline))
+AM_V_CCLD    = @$(info $   CCLD     $@$(info-trailing-newline))
+AM_V_CXXLD   = @$(info $   CXXLD    $@$(info-trailing-newline))
 ifeq ($(HAVE_NATIVE_COMP),yes)
 ifeq ($(NATIVE_DISABLED),1)
-AM_V_ELC     = @$(info $   ELC      $@)
+AM_V_ELC     = @$(info $   ELC      $@$(info-trailing-newline))
 AM_V_ELN =
 else
-AM_V_ELC     = @$(info $   ELC+ELN  $@)
-AM_V_ELN     = @$(info $   ELN      $@)
+AM_V_ELC     = @$(info $   ELC+ELN  $@$(info-trailing-newline))
+AM_V_ELN     = @$(info $   ELN      $@$(info-trailing-newline))
 endif
 else
-AM_V_ELC     = @$(info $   ELC      $@)
+AM_V_ELC     = @$(info $   ELC      $@$(info-trailing-newline))
 AM_V_ELN =
 endif
-AM_V_GEN     = @$(info $   GEN      $@)
+AM_V_GEN     = @$(info $   GEN      $@$(info-trailing-newline))
 AM_V_GLOBALS = @$(info $   GEN      globals.h)
 AM_V_NO_PD = --no-print-directory
-AM_V_RC      = @$(info $   RC       $@)
+AM_V_RC      = @$(info $   RC       $@$(info-trailing-newline))
 endif
-- 
2.32.0

Reply via email to