summaryrefslogtreecommitdiff
path: root/make/unit-cc.pl
blob: 5110037ace2ce851c59980fb1b749aa05d1e3d8a (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
#!/usr/bin/perl
use strict;
use warnings;
BEGIN { push @INC, '..'; }
use make::configure;

my $file = shift;
my $verbose;

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

my $out = shift;

my $cflags = nopedantic($file) ? $ENV{NICEFLAGS} : $ENV{FLAGS};
$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;