]>
Commit | Line | Data |
---|---|---|
164a5e3f MSO |
1 | #!/usr/bin/perl -w |
2 | ###################################################################### | |
3 | # Compiles or links files | |
4 | # | |
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 | |
9 | # | |
10 | # Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com> | |
11 | ###################################################################### | |
12 | use strict; | |
13 | my @args = (); | |
14 | my @cflags = (); | |
15 | my $is_linking = 0; | |
16 | while (@ARGV) { | |
17 | my $arg = shift @ARGV; | |
18 | if ("$arg" =~ /^-[DIMGO]/) { | |
19 | push(@cflags, $arg); | |
20 | } elsif ("$arg" eq "-o") { | |
21 | my $file_out = shift @ARGV; | |
22 | if ("$file_out" =~ /exe$/) { | |
23 | $is_linking = 1; | |
24 | push(@args, "-OUT:$file_out"); | |
25 | } else { | |
26 | push(@args, "-Fo$file_out"); | |
27 | } | |
28 | } elsif ("$arg" eq "-lz") { | |
29 | push(@args, "zlib.lib"); | |
30 | } elsif ("$arg" eq "-liconv") { | |
31 | push(@args, "iconv.lib"); | |
32 | } elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") { | |
33 | $arg =~ s/^-L/-LIBPATH:/; | |
34 | push(@args, $arg); | |
35 | } elsif ("$arg" =~ /^-R/) { | |
36 | # eat | |
37 | } else { | |
38 | push(@args, $arg); | |
39 | } | |
40 | } | |
41 | if ($is_linking) { | |
42 | unshift(@args, "link.exe"); | |
43 | } else { | |
44 | unshift(@args, "cl.exe"); | |
45 | push(@args, @cflags); | |
46 | } | |
47 | #printf("**** @args\n"); | |
48 | exit system(@args); |