Skip to content

Commit baaf7ed

Browse files
authored
Merge pull request #11 from ACCESS-NRI/mkmf-escape-fix
Mkmf escape fix
2 parents 0f27404 + 5f70241 commit baaf7ed

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bin/mkmf

+16
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,22 @@ if( $suffix eq '.a' ) {
467467
print MAKEFILE "$opt_p: \$(OBJ) $opt_l\n\t\$(LD) \$(OBJ) -o $opt_p $opt_l \$(LDFLAGS)\n";
468468
}
469469
close MAKEFILE;
470+
471+
# Make a copy of the completed Makefile, read it back in, escape all relevant `=` signs
472+
# and write it back out
473+
rename($mkfile, $mkfile.'.bak');
474+
open(IN, '<' . $mkfile.'.bak') or die $!;
475+
open(OUT, '>' . $mkfile) or die $!;
476+
477+
print OUT "EQUALS = =";
478+
479+
while(<IN>) {
480+
# Only escape '=' that aren't assignments (aka anything that spaces either side)
481+
$_ =~ s/(?<! )=(?! )/\$\(EQUALS\)/g;
482+
print OUT "$_";
483+
}
484+
close(IN);
485+
close(OUT);
470486
print " $mkfile is ready.\n";
471487

472488
exec 'make', '-f', $mkfile if $opt_x;

0 commit comments

Comments
 (0)