2009-09-01 15:04:40 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2009-09-18 14:05:49 +00:00
|
|
|
BEGIN { push @INC, $ENV{SOURCEPATH}; }
|
2009-09-01 15:04:40 +00:00
|
|
|
use make::configure;
|
|
|
|
|
2009-09-28 01:43:47 +00:00
|
|
|
chdir $ENV{BUILDPATH};
|
|
|
|
|
2009-09-28 00:55:42 +00:00
|
|
|
my $out = shift;
|
2009-09-01 15:04:40 +00:00
|
|
|
my $verbose;
|
|
|
|
|
2009-09-28 00:55:42 +00:00
|
|
|
if ($out =~ /^-/) {
|
|
|
|
$_ = $out;
|
|
|
|
$out = shift;
|
2009-09-01 15:04:40 +00:00
|
|
|
$verbose = /v/;
|
2010-01-17 03:17:25 +00:00
|
|
|
if (/f/) {
|
|
|
|
do_static_find(@ARGV);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
if (/l/) {
|
|
|
|
do_static_link(@ARGV);
|
|
|
|
exit;
|
|
|
|
}
|
2009-09-01 15:04:40 +00:00
|
|
|
}
|
|
|
|
|
2009-09-28 00:55:42 +00:00
|
|
|
my $file = shift;
|
2009-09-01 15:04:40 +00:00
|
|
|
|
2009-09-01 15:06:39 +00:00
|
|
|
my $cflags = $ENV{CXXFLAGS};
|
|
|
|
$cflags =~ s/ -pedantic// if nopedantic($file);
|
2009-09-01 15:04:40 +00:00
|
|
|
$cflags .= ' ' . getcompilerflags($file);
|
|
|
|
|
|
|
|
my $flags;
|
|
|
|
if ($out =~ /\.so$/) {
|
|
|
|
$flags = join ' ', $cflags, $ENV{PICLDFLAGS}, getlinkerflags($file);
|
|
|
|
} else {
|
|
|
|
$flags = "$cflags -c";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $execstr = "$ENV{RUNCC} $flags -o $out $file";
|
|
|
|
print "$execstr\n" if $verbose;
|
|
|
|
exec $execstr;
|
|
|
|
exit 1;
|
2010-01-17 03:17:25 +00:00
|
|
|
|
|
|
|
sub do_static_find {
|
|
|
|
my @flags;
|
|
|
|
for my $file (@ARGV) {
|
|
|
|
push @flags, getlinkerflags($file);
|
|
|
|
}
|
|
|
|
open F, '>', $out;
|
|
|
|
print F join ' ', @flags;
|
|
|
|
close F;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub do_static_link {
|
|
|
|
my $execstr = "$ENV{RUNCC} -o $out $ENV{CORELDFLAGS} $ENV{LDLIBS}";
|
|
|
|
for (@ARGV) {
|
|
|
|
if (/\.cmd$/) {
|
|
|
|
open F, '<', $_;
|
|
|
|
my $libs = <F>;
|
|
|
|
chomp $libs;
|
|
|
|
$execstr .= ' '.$libs;
|
|
|
|
close F;
|
|
|
|
} else {
|
|
|
|
$execstr .= ' '.$_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "$execstr\n" if $verbose;
|
|
|
|
exec $execstr;
|
|
|
|
exit 1;
|
|
|
|
}
|