From: Peter Harris Date: Thu, 24 Jun 2010 15:30:09 GMT Subject: Re: [PATCH 4/4] Makefile: Don't pass $(ALL_CFLAGS) to the linker Message-ID: In-Reply-To: <4C226520.5080009@ramsay1.demon.co.uk> On Wed, Jun 23, 2010 at 3:48 PM, Ramsay Jones wrote: > > The msvc debug build (make MSVC=1 DEBUG=1) issues a warning > on every invocation of the linker: > >    LINK : warning LNK4044: unrecognized option '/Zi'; ignored > > In order to suppress the warning, we refrain from passing the > $(ALL_CFLAGS) macro to the linker. Alternatively, we could leave the makefile alone and fix it up in compat/vcbuild/scripts/clink.pl (Apologies for the patch attached instead of inline; I'm not using a whitespace-clean email client at the moment.) Peter Harris diff --git a/Makefile b/Makefile index 7134509..dccee8e 100644 --- a/Makefile +++ b/Makefile @@ -1072,7 +1072,8 @@ ifndef DEBUG BASIC_LDFLAGS += -LTCG AR += -LTCG else BASIC_CFLAGS += -Zi -MTd + BASIC_LDFLAGS = -DEBUG -MAP endif X = .exe endif diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl index 4374771..aec9980 100644 --- a/compat/vcbuild/scripts/clink.pl +++ b/compat/vcbuild/scripts/clink.pl @@ -12,10 +12,14 @@ use strict; my @args = (); my @cflags = (); +my @lflags = (); my $is_linking = 0; +my %linkflag = ( '-DEBUG' => 1, '-MAP' => 1 ); while (@ARGV) { my $arg = shift @ARGV; - if ("$arg" =~ /^-[DIMGO]/) { + if ($linkflag{$arg}) { + push(@lflags, $arg); + } elsif ("$arg" =~ /^-[DIMGOZ]/) { push(@cflags, $arg); } elsif ("$arg" eq "-o") { my $file_out = shift @ARGV; @@ -44,6 +48,7 @@ while (@ARGV) { } if ($is_linking) { unshift(@args, "link.exe"); + push(@args, @lflags); } else { unshift(@args, "cl.exe"); push(@args, @cflags);