]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - make/unit-cc.pl
Merge insp20
[user/henk/code/inspircd.git] / make / unit-cc.pl
index 0a20738db0232dd22c720773924e347b3ac7aaff..f04423ce3cf20920223bc14d5fc5634dc2c8c846 100755 (executable)
@@ -36,7 +36,6 @@ chdir $ENV{BUILDPATH};
 
 my $type = shift;
 my $out = shift;
-my $verbose = ($type =~ s/-v$//);
 
 our %config = read_configure_cache();
 
@@ -61,7 +60,7 @@ exit 1;
 
 sub message($$$) {
        my ($type, $file, $command) = @_;
-       if ($verbose) {
+       if ($ENV{INSPIRCD_VERBOSE}) {
                print "$command\n";
        } else {
                print_format "\t<|GREEN $type:|>\t\t$file\n";
@@ -81,18 +80,19 @@ sub do_static_find {
 
 sub do_static_link {
        my $execstr = "$ENV{CXX} -o $out $ENV{CORELDFLAGS}";
+       my $link_flags = '';
        for (@ARGV) {
                if (/\.cmd$/) {
                        open F, '<', $_;
                        my $libs = <F>;
                        chomp $libs;
-                       $execstr .= ' '.$libs;
+                       $link_flags .= ' '.$libs;
                        close F;
                } else {
                        $execstr .= ' '.$_;
                }
        }
-       $execstr .= ' '.$ENV{LDLIBS};
+       $execstr .= ' '.$ENV{LDLIBS}.' '.$link_flags;
        message 'LINK', $out, $execstr;
        exec $execstr;
 }
@@ -104,7 +104,11 @@ sub do_core_link {
 }
 
 sub do_link_dir {
-       my $execstr = "$ENV{CXX} -o $out $ENV{PICLDFLAGS} @_";
+       my ($dir, $link_flags) = (shift, '');
+       for my $file (<$dir/*.cpp>) {
+               $link_flags .= get_property($file, 'LinkerFlags') . ' ';
+       }
+       my $execstr = "$ENV{CXX} -o $out $ENV{PICLDFLAGS} $link_flags @_";
        message 'LINK', $out, $execstr;
        exec $execstr;
 }