| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Alien::Build::Plugin::Build::Make; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 162990 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 49 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 44 |  | 
| 5 | 2 |  |  | 2 |  | 38 | use 5.008001; | 
|  | 2 |  |  |  |  | 7 |  | 
| 6 | 2 |  |  | 2 |  | 8 | use Carp (); | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 34 |  | 
| 7 | 2 |  |  | 2 |  | 279 | use Capture::Tiny qw( capture ); | 
|  | 2 |  |  |  |  | 17503 |  | 
|  | 2 |  |  |  |  | 107 |  | 
| 8 | 2 |  |  | 2 |  | 568 | use Alien::Build::Plugin; | 
|  | 2 |  |  |  |  | 3872 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | # ABSTRACT: Make plugin for Alien::Build | 
| 11 |  |  |  |  |  |  | our $VERSION = '0.01'; # VERSION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | has '+make_type' => undef; | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub init | 
| 17 |  |  |  |  |  |  | { | 
| 18 | 5 |  |  | 5 | 1 | 49067 | my($self, $meta) = @_; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 5 |  |  |  |  | 16 | $meta->add_requires('configure', 'Alien::Build::Plugin::Build::Make', '0.01'); | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 5 |  |  |  |  | 71 | my $type = $self->make_type; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 5 | 50 |  |  |  | 38 | return unless defined $type; | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 5 | 50 | 33 |  |  | 17 | $type = 'gmake' if $^O eq 'MSWin32' && $type eq 'umake'; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 5 | 100 |  |  |  | 21 | if($type eq 'nmake') | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 50 |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | { | 
| 30 | 1 |  |  | 1 |  | 11 | $meta->interpolator->replace_helper( make => sub { 'nmake' } ); | 
|  | 1 |  |  |  |  | 5105 |  | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | elsif($type eq 'dmake') | 
| 34 |  |  |  |  |  |  | { | 
| 35 | 1 |  |  | 1 |  | 3 | $meta->interpolator->replace_helper( make => sub { 'dmake' } ); | 
|  | 1 |  |  |  |  | 1336 |  | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | elsif($type eq 'gmake') | 
| 39 |  |  |  |  |  |  | { | 
| 40 | 2 |  |  |  |  | 4 | my $found = 0; | 
| 41 | 2 |  |  |  |  | 5 | foreach my $make (qw( gmake make mingw32-make )) | 
| 42 |  |  |  |  |  |  | { | 
| 43 | 6 |  |  | 6 |  | 218 | my($out, $err) = capture { system $make, '--version' }; | 
|  | 6 |  |  |  |  | 14182 |  | 
| 44 | 6 | 100 |  |  |  | 3878 | if($out =~ /GNU Make/) | 
| 45 |  |  |  |  |  |  | { | 
| 46 | 2 |  |  | 3 |  | 28 | $meta->interpolator->replace_helper( make => sub { $make } ); | 
|  | 3 |  |  |  |  | 39895 |  | 
| 47 | 2 |  |  |  |  | 741 | $found = 1; | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  | } | 
| 50 | 2 | 50 |  |  |  | 25 | unless($found) | 
| 51 |  |  |  |  |  |  | { | 
| 52 | 0 |  |  |  |  |  | $meta->add_requires('share' => 'Alien::gmake' => '0.20'); | 
| 53 | 0 |  |  | 0 |  |  | $meta->interpolator->replace_helper('make' => sub { require Alien::gmake; Alien::gmake->exe }); | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | elsif($type eq 'umake') | 
| 58 |  |  |  |  |  |  | { | 
| 59 |  |  |  |  |  |  | # nothing | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | else | 
| 63 |  |  |  |  |  |  | { | 
| 64 | 0 |  |  |  |  |  | Carp::croak("unknown make type = ", $self->make_type); | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | 1; | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | __END__ |