Repository: lucy-clownfish
Updated Branches:
  refs/heads/master 0be314b9d -> 7511e5c64


Run "make clean" to clean up Perl build

This also removes intermediate files that the Perl build system
can't know about.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/7511e5c6
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/7511e5c6
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/7511e5c6

Branch: refs/heads/master
Commit: 7511e5c64458ce1177c18b15a70d63a012d41ab7
Parents: 0be314b
Author: Nick Wellnhofer <[email protected]>
Authored: Mon Jul 11 13:41:25 2016 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Mon Jul 11 13:50:16 2016 +0200

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC/Perl/Build.pm   | 17 ++++++++++++----
 .../lib/Clownfish/CFC/Perl/Build/Charmonic.pm   | 21 +++++++++++++++++---
 2 files changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/7511e5c6/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm 
b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
index 9c1ff84..dfb9417 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -399,11 +399,10 @@ sub _compile_custom_xs {
     mkpath( $archdir, 0, 0777 ) unless -d $archdir;
     my @objects;
 
-    # Make core objects.
+    # Make objects.
     if ($module->{make_target}) {
-        my $core_objects = $self->cf_make_objects($module->{make_target});
-        push @objects, @$core_objects;
-        $self->add_to_cleanup(@$core_objects);
+        my $make_objects = $self->cf_make_objects($module->{make_target});
+        push @objects, @$make_objects;
     }
 
     # Compile C source files.
@@ -538,6 +537,16 @@ sub ACTION_code {
     $self->SUPER::ACTION_code;
 }
 
+sub ACTION_clean {
+    my $self = shift;
+
+    if ( $self->can('cf_make_clean') ) {
+        $self->cf_make_clean();
+    }
+
+    $self->SUPER::ACTION_clean;
+}
+
 # Monkey patch ExtUtils::CBuilder::Platform::Windows::GCC::format_linker_cmd
 # to make extensions work on MinGW.
 #

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/7511e5c6/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm 
b/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
index 97cc0b7..559d549 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
@@ -145,16 +145,31 @@ sub cf_make_objects {
 
     return [] unless $self->charmonizer_params('create_makefile');
 
+    $self->_cf_charm_run_make(lc($target));
+
+    return [ split( /\s+/, $self->charmony(uc($target)) ) ];
+}
+
+sub cf_make_clean {
+    my $self = shift;
+
+    return unless $self->charmonizer_params('create_makefile')
+                  && -e 'Makefile';
+
+    $self->_cf_charm_run_make('clean');
+}
+
+sub _cf_charm_run_make {
+    my ( $self, $target ) = @_;
+
     my $make_options = $self->charmonizer_params('make_options');
     my @command = (
         $self->config('make'),
         $self->split_like_shell($make_options),
-        lc($target),
+        $target,
     );
     print join(' ', @command), "\n";
     system @command and die($self->config('make') . " failed");
-
-    return [ split( /\s+/, $self->charmony(uc($target)) ) ];
 }
 
 1;

Reply via email to