From 5e712fa7763cb28a4ab8f763cab6d3746c24f857 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 10 Mar 2021 01:43:07 -0800 Subject: [PATCH v5 06/16] meson: prereq: add output path arg in generate-lwlocknames.pl --- src/backend/storage/lmgr/generate-lwlocknames.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/backend/storage/lmgr/generate-lwlocknames.pl b/src/backend/storage/lmgr/generate-lwlocknames.pl index 8a44946594d..315156b29f1 100644 --- a/src/backend/storage/lmgr/generate-lwlocknames.pl +++ b/src/backend/storage/lmgr/generate-lwlocknames.pl @@ -5,15 +5,21 @@ use strict; use warnings; +use Getopt::Long; + +my $output_path = '.'; my $lastlockidx = -1; my $continue = "\n"; +GetOptions( + 'output:s' => \$output_path); + open my $lwlocknames, '<', $ARGV[0] or die; # Include PID in suffix in case parallel make runs this multiple times. -my $htmp = "lwlocknames.h.tmp$$"; -my $ctmp = "lwlocknames.c.tmp$$"; +my $htmp = "$output_path/lwlocknames.h.tmp$$"; +my $ctmp = "$output_path/lwlocknames.c.tmp$$"; open my $h, '>', $htmp or die "Could not open $htmp: $!"; open my $c, '>', $ctmp or die "Could not open $ctmp: $!"; @@ -65,7 +71,7 @@ printf $h "#define NUM_INDIVIDUAL_LWLOCKS %s\n", $lastlockidx + 1; close $h; close $c; -rename($htmp, 'lwlocknames.h') || die "rename: $htmp: $!"; -rename($ctmp, 'lwlocknames.c') || die "rename: $ctmp: $!"; +rename($htmp, "$output_path/lwlocknames.h") || die "rename: $htmp to $output_path/lwlocknames.h: $!"; +rename($ctmp, "$output_path/lwlocknames.c") || die "rename: $ctmp: $!"; close $lwlocknames; -- 2.23.0.385.gbc12974a89