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} $ENV{LDLIBS}";
50 $execstr .= ' '.$libs;
56 print "$execstr\n" if $verbose;
61 my $execstr = "$ENV{RUNLD} -o $out $ENV{CORELDFLAGS} $ENV{LDLIBS} @_";
62 print "$execstr\n" if $verbose;
67 my $execstr = "$ENV{RUNLD} -o $out $ENV{PICLDFLAGS} @_";
68 print "$execstr\n" if $verbose;
73 my ($do_compile, $do_link, $file) = @_;
76 my $binary = $ENV{RUNCC};
78 $flags = $ENV{CXXFLAGS};
79 $flags =~ s/ -pedantic// if nopedantic($file);
80 $flags .= ' ' . getcompilerflags($file);
82 if ($file =~ m#(?:^|/)((?:m|cmd)_[^/. ]+)(?:\.cpp|/.*\.cpp)$#) {
83 $flags .= ' -DMODNAME='.$1.'.so';
86 $binary = $ENV{RUNLD};
90 $flags = join ' ', $flags, $ENV{PICLDFLAGS}, getlinkerflags($file);
95 my $execstr = "$binary -o $out $flags $file";
96 print "$execstr\n" if $verbose;