]>
git.ipfire.org Git - thirdparty/git.git/blob - compat/vcbuild/scripts/clink.pl
2 ######################################################################
3 # Compiles or links files
5 # This is a wrapper to facilitate the compilation of Git with MSVC
6 # using GNU Make as the build system. So, instead of manipulating the
7 # Makefile into something nasty, just to support non-space arguments
8 # etc, we use this wrapper to fix the command line options
10 # Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
11 ######################################################################
19 my $arg = shift @ARGV;
20 if ("$arg" eq "-DDEBUG") {
21 # Some vcpkg-based libraries have different names for release
22 # and debug versions. This hack assumes that -DDEBUG comes
23 # before any "-l*" flags.
26 if ("$arg" =~ /^-[DIMGOZ]/) {
28 } elsif ("$arg" eq "-o") {
29 my $file_out = shift @ARGV;
30 if ("$file_out" =~ /exe$/) {
32 # Create foo.exe and foo.pdb
33 push(@args, "-OUT:$file_out");
35 # Create foo.o and foo.o.pdb
36 push(@args, "-Fo$file_out");
37 push(@args, "-Fd$file_out.pdb");
39 } elsif ("$arg" eq "-lz") {
41 push(@args, "zlibd.lib");
43 push(@args, "zlib.lib");
45 } elsif ("$arg" eq "-liconv") {
46 push(@args, "libiconv.lib");
47 } elsif ("$arg" eq "-lcrypto") {
48 push(@args, "libeay32.lib");
49 } elsif ("$arg" eq "-lssl") {
50 push(@args, "ssleay32.lib");
51 } elsif ("$arg" eq "-lcurl") {
53 # Newer vcpkg definitions call this libcurl_imp.lib; Do we
54 # need to use that instead?
55 foreach my $flag (@lflags) {
56 if ($flag =~ /^-LIBPATH:(.*)/) {
57 foreach my $l ("libcurl_imp.lib", "libcurl.lib") {
66 } elsif ("$arg" eq "-lexpat") {
67 push(@args, "expat.lib");
68 } elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {
69 $arg =~ s/^-L/-LIBPATH:/;
71 } elsif ("$arg" =~ /^-R/) {
79 unshift(@args, "link.exe");
81 unshift(@args, "cl.exe");
84 printf(STDERR
"**** @args\n\n\n") if (!defined($ENV{'QUIET_GEN'}));
85 exit (system(@args) != 0);