| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Alien::Build::Plugin::Build::Make; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 1211 | use strict; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 55 |  | 
| 4 | 2 |  |  | 2 |  | 9 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 42 |  | 
| 5 | 2 |  |  | 2 |  | 33 | use 5.008004; | 
|  | 2 |  |  |  |  | 7 |  | 
| 6 | 2 |  |  | 2 |  | 8 | use Carp (); | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 42 |  | 
| 7 | 2 |  |  | 2 |  | 10 | use Capture::Tiny qw( capture ); | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 127 |  | 
| 8 | 2 |  |  | 2 |  | 345 | use Alien::Build::Plugin; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 13 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | # ABSTRACT: Make plugin for Alien::Build | 
| 11 |  |  |  |  |  |  | our $VERSION = '2.47'; # VERSION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | has '+make_type' => undef; | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub init | 
| 17 |  |  |  |  |  |  | { | 
| 18 | 5 |  |  | 5 | 1 | 12 | my($self, $meta) = @_; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 5 |  |  |  |  | 23 | $meta->add_requires('configure', 'Alien::Build::Plugin::Build::Make', '0.99'); | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 5 |  |  |  |  | 23 | my $type = $self->make_type; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 5 | 50 |  |  |  | 14 | return unless defined $type; | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 5 | 50 | 33 |  |  | 20 | $type = 'gmake' if $^O eq 'MSWin32' && $type eq 'umake'; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 5 | 100 |  |  |  | 32 | if($type eq 'nmake') | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 50 |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | { | 
| 30 | 1 |  |  | 1 |  | 3 | $meta->interpolator->replace_helper( make => sub { 'nmake' } ); | 
|  | 1 |  |  |  |  | 3 |  | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | elsif($type eq 'dmake') | 
| 34 |  |  |  |  |  |  | { | 
| 35 | 1 |  |  | 1 |  | 2 | $meta->interpolator->replace_helper( make => sub { 'dmake' } ); | 
|  | 1 |  |  |  |  | 3 |  | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | elsif($type eq 'gmake') | 
| 39 |  |  |  |  |  |  | { | 
| 40 | 2 |  |  |  |  | 5 | my $found = 0; | 
| 41 | 2 |  |  |  |  | 6 | foreach my $make (qw( gmake make mingw32-make )) | 
| 42 |  |  |  |  |  |  | { | 
| 43 | 6 |  |  | 6 |  | 470 | my($out, $err) = capture { system $make, '--version' }; | 
|  | 6 |  |  |  |  | 32826 |  | 
| 44 | 6 | 100 |  |  |  | 8393 | if($out =~ /GNU Make/) | 
| 45 |  |  |  |  |  |  | { | 
| 46 | 2 |  |  | 0 |  | 65 | $meta->interpolator->replace_helper( make => sub { $make } ); | 
|  | 0 |  |  |  |  | 0 |  | 
| 47 | 2 |  |  |  |  | 19 | $found = 1; | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  | } | 
| 50 | 2 | 50 |  |  |  | 58 | 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__ |