contrib/buildsystems: optionally capture the dry-run in a file

Add an option for capturing the output of the make dry-run used in determining the msvc-build structure for easy debugging. You can use the output of `--make-out <path>` in subsequent runs via the `--in <path>` option. Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Philip Oakley committed Jul 29, 2019 at 13:08 UTC a530a59a6f6298622460805e28dfb2b49dd1cf11
1 file changed +10
contrib/buildsystems/engine.pl
+10
@@ -32,6 +32,7 @@ generate usage:
32 -g <GENERATOR> --gen <GENERATOR> Specify the buildsystem generator (default: $gen)
33 Available: $genlist
34 -o <PATH> --out <PATH> Specify output directory generation (default: .)
35 + --make-out <PATH> Write the output of GNU Make into a file
36 -i <FILE> --in <FILE> Specify input file, instead of running GNU Make
37 -h,-? --help This help
38 EOM
@@ -39,6 +40,7 @@ EOM
40 }
41
42 # Parse command-line options
43 +my $make_out;
44 while (@ARGV) {
45 my $arg = shift @ARGV;
46 if ("$arg" eq "-h" || "$arg" eq "--help" || "$arg" eq "-?") {
@@ -46,6 +48,8 @@ while (@ARGV) {
48 exit(0);
49 } elsif("$arg" eq "--out" || "$arg" eq "-o") {
50 $out_dir = shift @ARGV;
51 + } elsif("$arg" eq "--make-out") {
52 + $make_out = shift @ARGV;
53 } elsif("$arg" eq "--gen" || "$arg" eq "-g") {
54 $gen = shift @ARGV;
55 } elsif("$arg" eq "--in" || "$arg" eq "-i") {
@@ -80,6 +84,12 @@ my $ErrsFile = "msvc-build-makedryerrors.txt";
84 # test for an empty Errors file and remove it
85 unlink $ErrsFile if -f -z $ErrsFile;
86
87 +if (defined $make_out) {
88 + open OUT, ">" . $make_out;
89 + print OUT @makedry;
90 + close OUT;
91 +}
92 +
93 # Parse the make output into usable info
94 parseMakeOutput();
95