summaryrefslogtreecommitdiff
path: root/make/unit-cc.pl
diff options
context:
space:
mode:
Diffstat (limited to 'make/unit-cc.pl')
-rwxr-xr-xmake/unit-cc.pl56
1 files changed, 28 insertions, 28 deletions
diff --git a/make/unit-cc.pl b/make/unit-cc.pl
index 66e9b15dc..0a20738db 100755
--- a/make/unit-cc.pl
+++ b/make/unit-cc.pl
@@ -19,10 +19,18 @@
#
+BEGIN {
+ push @INC, $ENV{SOURCEPATH};
+ require 5.10.0;
+}
+
use strict;
-use warnings;
-BEGIN { push @INC, $ENV{SOURCEPATH}; }
+use warnings FATAL => qw(all);
+
+use File::Spec::Functions qw(abs2rel);
+
use make::configure;
+use make::console;
chdir $ENV{BUILDPATH};
@@ -30,21 +38,7 @@ my $type = shift;
my $out = shift;
my $verbose = ($type =~ s/-v$//);
-## BEGIN HACK: REMOVE IN 2.2!
-sub read_config_cache {
- my %cfg = ();
- open(CACHE, '../.config.cache') or return %cfg;
- while (my $line = <CACHE>) {
- next if $line =~ /^\s*($|\#)/;
- my ($key, $value) = ($line =~ /^(\S+)="(.*)"$/);
- $cfg{$key} = $value;
- }
- close(CACHE);
- return %cfg;
-}
-
-our %config = read_config_cache();
-## END HACK
+our %config = read_configure_cache();
if ($type eq 'gen-ld') {
do_static_find(@ARGV);
@@ -65,6 +59,15 @@ if ($type eq 'gen-ld') {
}
exit 1;
+sub message($$$) {
+ my ($type, $file, $command) = @_;
+ if ($verbose) {
+ print "$command\n";
+ } else {
+ print_format "\t<|GREEN $type:|>\t\t$file\n";
+ }
+}
+
sub do_static_find {
my @flags;
for my $file (@ARGV) {
@@ -77,7 +80,7 @@ sub do_static_find {
}
sub do_static_link {
- my $execstr = "$ENV{RUNLD} -o $out $ENV{CORELDFLAGS}";
+ my $execstr = "$ENV{CXX} -o $out $ENV{CORELDFLAGS}";
for (@ARGV) {
if (/\.cmd$/) {
open F, '<', $_;
@@ -90,19 +93,19 @@ sub do_static_link {
}
}
$execstr .= ' '.$ENV{LDLIBS};
- print "$execstr\n" if $verbose;
+ message 'LINK', $out, $execstr;
exec $execstr;
}
sub do_core_link {
- my $execstr = "$ENV{RUNLD} -o $out $ENV{CORELDFLAGS} @_ $ENV{LDLIBS}";
- print "$execstr\n" if $verbose;
+ my $execstr = "$ENV{CXX} -o $out $ENV{CORELDFLAGS} @_ $ENV{LDLIBS}";
+ message 'LINK', $out, $execstr;
exec $execstr;
}
sub do_link_dir {
- my $execstr = "$ENV{RUNLD} -o $out $ENV{PICLDFLAGS} @_";
- print "$execstr\n" if $verbose;
+ my $execstr = "$ENV{CXX} -o $out $ENV{PICLDFLAGS} @_";
+ message 'LINK', $out, $execstr;
exec $execstr;
}
@@ -111,15 +114,12 @@ sub do_compile {
my $flags = '';
my $libs = '';
- my $binary = $ENV{RUNCC};
if ($do_compile) {
$flags = $ENV{CORECXXFLAGS} . ' ' . get_property($file, 'CompileFlags');
if ($file =~ m#(?:^|/)((?:m|core)_[^/. ]+)(?:\.cpp|/.*\.cpp)$#) {
$flags .= ' -DMODNAME=\\"'.$1.'\\"';
}
- } else {
- $binary = $ENV{RUNLD};
}
if ($do_link) {
@@ -129,7 +129,7 @@ sub do_compile {
$flags .= ' -c';
}
- my $execstr = "$binary -o $out $flags $file $libs";
- print "$execstr\n" if $verbose;
+ my $execstr = "$ENV{CXX} -o $out $flags $file $libs";
+ message 'BUILD', abs2rel($file, "$ENV{SOURCEPATH}/src"), $execstr;
exec $execstr;
}