Skip to content

Commit 35d19a9

Browse files
committed
MSVC: Process Makefile line continuations more like "make" does.
Unlike "make" itself, the MSVC build process recognized a continuation even with whitespace after the backslash. (Due to a typo, some code sites accepted the letter "s" instead of whitespace). Also, it would consume any number of newlines following a single backslash. This is mere cleanup; those behaviors were unlikely to cause bugs.
1 parent 91f03ba commit 35d19a9

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/tools/msvc/Install.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ sub GenerateConversionScript
307307

308308
print "Generating conversion proc script...";
309309
my $mf = read_file('src/backend/utils/mb/conversion_procs/Makefile');
310-
$mf =~ s{\\\s*[\r\n]+}{}mg;
310+
$mf =~ s{\\\r?\n}{}g;
311311
$mf =~ /^CONVERSIONS\s*=\s*(.*)$/m
312312
|| die "Could not find CONVERSIONS line in conversions Makefile\n";
313313
my @pieces = split /\s+/, $1;
@@ -341,7 +341,7 @@ sub GenerateTimezoneFiles
341341
my $target = shift;
342342
my $conf = shift;
343343
my $mf = read_file("src/timezone/Makefile");
344-
$mf =~ s{\\\s*[\r\n]+}{}mg;
344+
$mf =~ s{\\\r?\n}{}g;
345345
$mf =~ /^TZDATA\s*:?=\s*(.*)$/m
346346
|| die "Could not find TZDATA row in timezone makefile\n";
347347
my @tzfiles = split /\s+/, $1;
@@ -360,7 +360,7 @@ sub GenerateTsearchFiles
360360
my $F;
361361
my $tmpl = read_file('src/backend/snowball/snowball.sql.in');
362362
my $mf = read_file('src/backend/snowball/Makefile');
363-
$mf =~ s{\\\s*[\r\n]+}{}mg;
363+
$mf =~ s{\\\r?\n}{}g;
364364
$mf =~ /^LANGUAGES\s*=\s*(.*)$/m
365365
|| die "Could not find LANGUAGES line in snowball Makefile\n";
366366
my @pieces = split /\s+/, $1;
@@ -415,7 +415,7 @@ sub CopyContribFiles
415415
next if ($d eq "sepgsql");
416416

417417
my $mf = read_file("contrib/$d/Makefile");
418-
$mf =~ s{\\s*[\r\n]+}{}mg;
418+
$mf =~ s{\\\r?\n}{}g;
419419

420420
# Note: we currently don't support setting MODULEDIR in the makefile
421421
my $moduledir = 'contrib';
@@ -587,7 +587,7 @@ qq{xcopy /s /i /q /r /y src\\include\\$d\\*.h "$ctarget\\include\\server\\$d\\"}
587587
closedir($D);
588588

589589
my $mf = read_file('src/interfaces/ecpg/include/Makefile');
590-
$mf =~ s{\\s*[\r\n]+}{}mg;
590+
$mf =~ s{\\\r?\n}{}g;
591591
$mf =~ /^ecpg_headers\s*=\s*(.*)$/m
592592
|| croak "Could not find ecpg_headers line\n";
593593
CopyFiles(

src/tools/msvc/Mkvcbuild.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ sub mkvcbuild
524524

525525
$mf =
526526
Project::read_file('src\backend\utils\mb\conversion_procs\Makefile');
527-
$mf =~ s{\\s*[\r\n]+}{}mg;
527+
$mf =~ s{\\\r?\n}{}g;
528528
$mf =~ m{SUBDIRS\s*=\s*(.*)$}m
529529
|| die 'Could not match in conversion makefile' . "\n";
530530
foreach my $sub (split /\s+/, $1)
@@ -536,7 +536,7 @@ sub mkvcbuild
536536
}
537537

538538
$mf = Project::read_file('src\bin\scripts\Makefile');
539-
$mf =~ s{\\s*[\r\n]+}{}mg;
539+
$mf =~ s{\\\r?\n}{}g;
540540
$mf =~ m{PROGRAMS\s*=\s*(.*)$}m
541541
|| die 'Could not match in bin\scripts\Makefile' . "\n";
542542
foreach my $prg (split /\s+/, $1)
@@ -674,7 +674,7 @@ sub GenerateContribSqlFiles
674674
{
675675
my $n = shift;
676676
my $mf = shift;
677-
$mf =~ s{\\\s*[\r\n]+}{}mg;
677+
$mf =~ s{\\\r?\n}{}g;
678678
if ($mf =~ /^DATA_built\s*=\s*(.*)$/mg)
679679
{
680680
my $l = $1;

src/tools/msvc/Project.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ sub AddDir
193193
my $mf = <$MF>;
194194
close($MF);
195195

196-
$mf =~ s{\\\s*[\r\n]+}{}mg;
196+
$mf =~ s{\\\r?\n}{}g;
197197
if ($mf =~ m{^(?:SUB)?DIRS[^=]*=\s*(.*)$}mg)
198198
{
199199
foreach my $subdir (split /\s+/, $1)

src/tools/msvc/Solution.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ EOF
422422
}
423423

424424
my $mf = Project::read_file('src\backend\catalog\Makefile');
425-
$mf =~ s{\\s*[\r\n]+}{}mg;
425+
$mf =~ s{\\\r?\n}{}g;
426426
$mf =~ /^POSTGRES_BKI_SRCS\s*:?=[^,]+,(.*)\)$/gm
427427
|| croak "Could not find POSTGRES_BKI_SRCS in Makefile\n";
428428
my @allbki = split /\s+/, $1;

src/tools/msvc/vcregress.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ sub fetchTests
358358
close($handle);
359359
my $t = "";
360360

361-
$m =~ s/\\[\r\n]*//gs;
361+
$m =~ s{\\\r?\n}{}g;
362362
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
363363
{
364364
$t = $1;

0 commit comments

Comments
 (0)