From 5f70241b0c4422f5791b564c6b3dc7398a634579 Mon Sep 17 00:00:00 2001 From: Tommy Gatti Date: Wed, 8 Nov 2023 15:00:52 +1100 Subject: [PATCH] mkmf: Post-makefile-creation replacement of all '=' with '$(EQUALS)' for non-assignment operations --- bin/mkmf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/mkmf b/bin/mkmf index 75f3cd58c2..566f16d1a8 100755 --- a/bin/mkmf +++ b/bin/mkmf @@ -467,6 +467,22 @@ if( $suffix eq '.a' ) { print MAKEFILE "$opt_p: \$(OBJ) $opt_l\n\t\$(LD) \$(OBJ) -o $opt_p $opt_l \$(LDFLAGS)\n"; } close MAKEFILE; + +# Make a copy of the completed Makefile, read it back in, escape all relevant `=` signs +# and write it back out +rename($mkfile, $mkfile.'.bak'); +open(IN, '<' . $mkfile.'.bak') or die $!; +open(OUT, '>' . $mkfile) or die $!; + +print OUT "EQUALS = ="; + +while() { + # Only escape '=' that aren't assignments (aka anything that spaces either side) + $_ =~ s/(?