Skip to content

Commit

Permalink
Replaced all '=' with '$(EQUALS)' for non-assignment operations
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeGat committed Nov 8, 2023
1 parent 0f27404 commit a22def9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bin/mkmf
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,32 @@ if( $suffix eq '.a' ) {
print MAKEFILE "$opt_p: \$(OBJ) $opt_l\n\t\$(LD) \$(OBJ) -o $opt_p $opt_l \$(LDFLAGS)\n";
}
close MAKEFILE;

sub escapeEqualsSign {
my $val = shift;
$val =~ s/=/\$\(EQUALS\)/g;
return $val;
}

# Make a copy of the completed Makefile, read it back in, escape all `=` signs
# and write it back out
rename($mkfile, $mkfile.'.bak');
open(IN, '<' . $mkfile.'.bak') or die $!;
open(OUT, '>' . $mkfile) or die $!;

print OUT "EQUALS= =\n";

while(<IN>) {
# Only escape ASSIGN_OP lines after assignment
if (/^(\S+) = (.*)/) {
$_ = "$1 = " . escapeEqualsSign($2);
} else {
$_ = escapeEqualsSign($_);
}
print OUT $_;
}
close(IN);
close(OUT);
print " $mkfile is ready.\n";

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

0 comments on commit a22def9

Please sign in to comment.