| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Inline::MakeMaker; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 1045 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use base 'Exporter'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 131 |  | 
| 5 | 1 |  |  | 1 |  | 703 | use ExtUtils::MakeMaker(); | 
|  | 1 |  |  |  |  | 79373 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 6 | 1 |  |  | 1 |  | 7 | use Carp; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 54 |  | 
| 7 | 1 |  |  | 1 |  | 5 | use version; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | our @EXPORT = qw(WriteMakefile WriteInlineMakefile); | 
| 10 |  |  |  |  |  |  | our $VERSION = '0.85_003'; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub WriteInlineMakefile { | 
| 13 | 0 |  |  | 0 | 0 |  | carp < | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | ======================== DEPRECATION ALERT ====================== | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | WriteInlineMakefile was deprecated in 2002. This warning is from 2014. | 
| 18 |  |  |  |  |  |  | WriteInlineMakefile will soon be removed. Please change this Makefile.PL | 
| 19 |  |  |  |  |  |  | to use WriteMakefile instead. | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | ========================== MESSAGE ENDS ========================= | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | EOF | 
| 24 | 0 |  |  |  |  |  | goto &WriteMakefile; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | sub WriteMakefile { | 
| 28 | 0 |  |  | 0 | 0 |  | my %args = @_; | 
| 29 |  |  |  |  |  |  | my $name = $args{NAME} | 
| 30 | 0 | 0 |  |  |  |  | or croak "Inline::MakeMaker::WriteMakefile requires the NAME parameter\n"; | 
| 31 | 0 |  |  |  |  |  | my $version = ''; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 0 | 0 | 0 |  |  |  | croak < | 
| 34 |  |  |  |  |  |  | Inline::MakeMaker::WriteMakefile requires either the VERSION or VERSION_FROM | 
| 35 |  |  |  |  |  |  | parameter. | 
| 36 |  |  |  |  |  |  | END | 
| 37 | 0 | 0 |  |  |  |  | if (defined $args{VERSION}) { | 
| 38 | 0 |  |  |  |  |  | $version = $args{VERSION}; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  | else { | 
| 41 |  |  |  |  |  |  | $version = ExtUtils::MM_Unix->parse_version($args{VERSION_FROM}) | 
| 42 | 0 | 0 |  |  |  |  | or croak "Can't determine version for $name\n"; | 
| 43 |  |  |  |  |  |  | } | 
| 44 | 0 | 0 |  |  |  |  | croak "Invalid 'version.pm' version '$version' for '$name'.\n" | 
| 45 |  |  |  |  |  |  | unless version::is_lax($version); | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | # Provide a convenience rule to clean up Inline's messes | 
| 48 |  |  |  |  |  |  | $args{clean} = { FILES => "_Inline *.inl " } | 
| 49 | 0 | 0 |  |  |  |  | unless defined $args{clean}; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | # Add Inline to the dependencies | 
| 52 | 0 | 0 |  |  |  |  | $args{PREREQ_PM}{Inline} = '0.44' unless defined $args{PREREQ_PM}{Inline}; | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 |  |  |  |  |  | my $mm = &ExtUtils::MakeMaker::WriteMakefile(%args); | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 0 |  |  |  |  |  | my (@objects, @obj_rules); | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 0 | 0 | 0 |  |  |  | if (@{$mm->{PMLIBDIRS}} && $mm->{PM}) { | 
|  | 0 |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | # Sort them longest first so we'll match subdirectories before their parents | 
| 60 | 0 |  |  |  |  |  | my @libdirs = sort { length($b) <=> length($a) } @{$mm->{PMLIBDIRS}}; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 0 |  |  |  |  |  | for my $path (keys %{$mm->{PM}}) { | 
|  | 0 |  |  |  |  |  |  | 
| 63 | 0 |  |  |  |  |  | for my $lib (@libdirs) { | 
| 64 | 0 | 0 |  |  |  |  | if (index($path,$lib) == 0) { | 
| 65 | 0 |  |  |  |  |  | my ($vol, $dirs, $file) = File::Spec->splitpath(substr($path, length($lib)+1)); | 
| 66 | 0 |  |  |  |  |  | my @dirs = File::Spec->splitdir($dirs); | 
| 67 | 0 | 0 |  |  |  |  | pop @dirs unless length($dirs[$#dirs]); | 
| 68 | 0 | 0 |  |  |  |  | next unless ($file =~ /.pm$/); | 
| 69 | 0 |  |  |  |  |  | $file =~ s/\.[^.]+$//; | 
| 70 |  |  |  |  |  |  |  | 
| 71 | 0 |  |  |  |  |  | push @objects, join('::', @dirs, $file); | 
| 72 | 0 |  |  |  |  |  | push @obj_rules, join('-', @dirs, "$file.inl"); | 
| 73 | 0 |  |  |  |  |  | last; | 
| 74 |  |  |  |  |  |  | } | 
| 75 | 0 |  |  |  |  |  | croak "Failed to find module path for '$path'"; | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  | } else { | 
| 79 |  |  |  |  |  |  | # no modules found in PMLIBDIRS so assume we've just got $name to do | 
| 80 | 0 |  |  |  |  |  | @objects = $name; | 
| 81 | 0 |  |  |  |  |  | $name =~ s/::/-/g; | 
| 82 | 0 |  |  |  |  |  | @obj_rules = ("$name.inl"); | 
| 83 |  |  |  |  |  |  | } | 
| 84 |  |  |  |  |  |  |  | 
| 85 | 0 | 0 |  |  |  |  | if (@objects) { | 
| 86 | 0 | 0 |  |  |  |  | open MAKEFILE, '>> Makefile' | 
| 87 |  |  |  |  |  |  | or croak "Inline::MakeMaker::WriteMakefile can't append to Makefile:\n$!"; | 
| 88 |  |  |  |  |  |  |  | 
| 89 | 0 |  |  |  |  |  | print MAKEFILE < | 
| 90 |  |  |  |  |  |  | # Well, not quite. Inline::MakeMaker is adding this: | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | # --- MakeMaker inline section: | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | MAKEFILE | 
| 95 | 0 |  |  |  |  |  | for (0..$#objects) { | 
| 96 |  |  |  |  |  |  | # the subdivision in hashes is done to avoid {}, which break dmake | 
| 97 | 0 |  |  |  |  |  | print MAKEFILE < | 
| 98 |  |  |  |  |  |  | $obj_rules[$_] : pm_to_blib | 
| 99 |  |  |  |  |  |  | \t\$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$objects[$_] -e"my %A = (modinlname => '$obj_rules[$_]', module => '$objects[$_]'); my %S = (API => \\%A); Inline::satisfy_makefile_dep(\\%S);" $version \$(INST_ARCHLIB) | 
| 100 |  |  |  |  |  |  | MAKEFILE | 
| 101 |  |  |  |  |  |  | } | 
| 102 |  |  |  |  |  |  |  | 
| 103 | 0 |  |  |  |  |  | print MAKEFILE "\ndynamic :: ",join(' ',@obj_rules),"\n"; | 
| 104 |  |  |  |  |  |  |  | 
| 105 | 0 |  |  |  |  |  | print MAKEFILE < | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | # The End is here. | 
| 108 |  |  |  |  |  |  | MAKEFILE | 
| 109 |  |  |  |  |  |  |  | 
| 110 | 0 |  |  |  |  |  | close MAKEFILE; | 
| 111 |  |  |  |  |  |  | } | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | 1; |