4 BEGIN { push @INC, $ENV{SOURCEPATH}; }
11 my $verbose = ($type =~ s/-v$//);
13 if ($type eq 'gen-ld') {
14 do_static_find(@ARGV);
15 } elsif ($type eq 'static-ld') {
16 do_static_link(@ARGV);
17 } elsif ($type eq 'core-ld') {
19 } elsif ($type eq 'link-dir') {
21 } elsif ($type eq 'gen-o') {
22 do_compile(1, 0, @ARGV);
23 } elsif ($type eq 'gen-so') {
24 do_compile(1, 1, @ARGV);
25 } elsif ($type eq 'link-so') {
26 do_compile(0, 1, @ARGV);
28 print STDERR "Unknown unit-cc subcommand $type!\n";
34 for my $file (@ARGV) {
35 push @flags, getlinkerflags($file);
38 print F join ' ', @flags;
44 my $execstr = "$ENV{RUNLD} -o $out $ENV{CORELDFLAGS}";
50 $execstr .= ' '.$libs;
56 $execstr .= ' '.$ENV{LDLIBS};
57 print "$execstr\n" if $verbose;
62 my $execstr = "$ENV{RUNLD} -o $out $ENV{CORELDFLAGS} @_ $ENV{LDLIBS}";
63 print "$execstr\n" if $verbose;
68 my $execstr = "$ENV{RUNLD} -o $out $ENV{PICLDFLAGS} @_";
69 print "$execstr\n" if $verbose;
74 my ($do_compile, $do_link, $file) = @_;
78 my $binary = $ENV{RUNCC};
80 $flags = $ENV{CXXFLAGS};
81 $flags =~ s/ -pedantic// if nopedantic($file);
82 $flags .= ' ' . getcompilerflags($file);
84 if ($file =~ m#(?:^|/)((?:m|cmd)_[^/. ]+)(?:\.cpp|/.*\.cpp)$#) {
85 $flags .= ' -DMODNAME='.$1.'.so';
88 $binary = $ENV{RUNLD};
92 $flags = join ' ', $flags, $ENV{PICLDFLAGS};
93 $libs = join ' ', getlinkerflags($file);
98 my $execstr = "$binary -o $out $flags $file $libs";
99 print "$execstr\n" if $verbose;