+sub do_link_dir {
+ my $execstr = "$ENV{RUNLD} -o $out $ENV{PICLDFLAGS} @_";
+ print "$execstr\n" if $verbose;
+ exec $execstr;
+}
+
+sub do_compile {
+ my ($do_compile, $do_link, $file) = @_;
+
+ 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) {
+ $flags = join ' ', $flags, $ENV{PICLDFLAGS};
+ $libs = get_property($file, 'LinkerFlags');
+ } else {
+ $flags .= ' -c';
+ }
+
+ my $execstr = "$binary -o $out $flags $file $libs";
+ print "$execstr\n" if $verbose;
+ exec $execstr;
+}