]> git.ipfire.org Git - thirdparty/git.git/blobdiff - contrib/buildsystems/engine.pl
msvc: add a Makefile target to pre-generate the Visual Studio solution
[thirdparty/git.git] / contrib / buildsystems / engine.pl
index 9db3d43a1eb2f7528ebd29a5c18ebe415abd45cb..fba8a3f056a0e16591496f77a8b505ec01d01964 100755 (executable)
@@ -32,6 +32,7 @@ generate usage:
   -g <GENERATOR>  --gen <GENERATOR> Specify the buildsystem generator    (default: $gen)
                                     Available: $genlist
   -o <PATH>       --out <PATH>      Specify output directory generation  (default: .)
+                  --make-out <PATH> Write the output of GNU Make into a file
   -i <FILE>       --in <FILE>       Specify input file, instead of running GNU Make
   -h,-?           --help            This help
 EOM
@@ -39,6 +40,7 @@ EOM
 }
 
 # Parse command-line options
+my $make_out;
 while (@ARGV) {
     my $arg = shift @ARGV;
     if ("$arg" eq "-h" || "$arg" eq "--help" || "$arg" eq "-?") {
@@ -46,6 +48,8 @@ while (@ARGV) {
        exit(0);
     } elsif("$arg" eq "--out" || "$arg" eq "-o") {
        $out_dir = shift @ARGV;
+    } elsif("$arg" eq "--make-out") {
+       $make_out = shift @ARGV;
     } elsif("$arg" eq "--gen" || "$arg" eq "-g") {
        $gen = shift @ARGV;
     } elsif("$arg" eq "--in" || "$arg" eq "-i") {
@@ -53,6 +57,8 @@ while (@ARGV) {
         open(F, "<$infile") || die "Couldn't open file $infile";
         @makedry = <F>;
         close(F);
+    } else {
+        die "Unknown option: " . $arg;
     }
 }
 
@@ -73,7 +79,19 @@ Running GNU Make to figure out build structure...
 EOM
 
 # Pipe a make --dry-run into a variable, if not already loaded from file
-@makedry = `cd $git_dir && make -n MSVC=1 V=1 2>/dev/null` if !@makedry;
+# Capture the make dry stderr to file for review (will be empty for a release build).
+
+my $ErrsFile = "msvc-build-makedryerrors.txt";
+@makedry = `make -C $git_dir -n MSVC=1 SKIP_VCPKG=1 V=1 2>$ErrsFile`
+if !@makedry;
+# test for an empty Errors file and remove it
+unlink $ErrsFile if -f -z $ErrsFile;
+
+if (defined $make_out) {
+    open OUT, ">" . $make_out;
+    print OUT @makedry;
+    close OUT;
+}
 
 # Parse the make output into usable info
 parseMakeOutput();
@@ -324,11 +342,17 @@ sub handleLinkLine
             $appout = shift @parts;
         } elsif ("$part" eq "-lz") {
             push(@libs, "zlib.lib");
-       } elsif ("$part" eq "-lcrypto") {
+        } elsif ("$part" eq "-lcrypto") {
             push(@libs, "libeay32.lib");
         } elsif ("$part" eq "-lssl") {
             push(@libs, "ssleay32.lib");
-        } elsif ($part =~ /^-/) {
+        } elsif ("$part" eq "-lcurl") {
+            push(@libs, "libcurl.lib");
+        } elsif ("$part" eq "-lexpat") {
+            push(@libs, "expat.lib");
+        } elsif ("$part" eq "-liconv") {
+            push(@libs, "libiconv.lib");
+        } elsif ($part =~ /^[-\/]/) {
             push(@lflags, $part);
         } elsif ($part =~ /\.(a|lib)$/) {
             $part =~ s/\.a$/.lib/;