+ $execstr .= ' '.$ENV{LDLIBS};
+ message 'LINK', $out, $execstr;
+ exec $execstr;
+}
+
+sub do_core_link {
+ my $execstr = "$ENV{CXX} -o $out $ENV{CORELDFLAGS} @_ $ENV{LDLIBS}";
+ message 'LINK', $out, $execstr;
+ exec $execstr;
+}
+
+sub do_link_dir {
+ 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;
+}
+
+sub do_compile {
+ my ($do_compile, $do_link, $file) = @_;
+
+ my $flags = '';
+ my $libs = '';
+ if ($do_compile) {
+ $flags = $ENV{CORECXXFLAGS} . ' ' . get_property($file, 'CompileFlags');
+
+ if ($file =~ m#(?:^|/)((?:m|core)_[^/. ]+)(?:\.cpp|/.*\.cpp)$#) {
+ $flags .= ' -DMODNAME=\\"'.$1.'\\"';
+ }
+ }
+
+ if ($do_link) {
+ $flags = join ' ', $flags, $ENV{PICLDFLAGS};
+ $libs = get_property($file, 'LinkerFlags');
+ } else {
+ $flags .= ' -c';
+ }
+
+ my $execstr = "$ENV{CXX} -o $out $flags $file $libs";
+ message 'BUILD', abs2rel($file, "$ENV{SOURCEPATH}/src"), $execstr;