summaryrefslogtreecommitdiff
path: root/make/unit-cc.pl
blob: 23a7dfb76fb7d74f031c8f137446760ec0d9c26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
use strict;
use warnings;
BEGIN { push @INC, $ENV{SOURCEPATH}; }
use make::configure;

chdir $ENV{BUILDPATH};

my $out = shift;
my $verbose;

if ($out =~ /^-/) {
	$_ = $out;
	$out = shift;
	$verbose = /v/;
}

my $file = shift;

my $cflags = $ENV{CXXFLAGS};
$cflags =~ s/ -pedantic// if nopedantic($file);
$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;