Skip to content

Commit 8c25b07

Browse files
committed
Breakup MakeMaker->new: generate_makefile method
1 parent 7a0bc56 commit 8c25b07

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

lib/ExtUtils/MakeMaker.pm

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ my @Prepend_parent;
2424
my %Recognized_Att_Keys;
2525
our %macro_fsentity; # whether a macro is a filesystem name
2626
our %macro_dep; # whether a macro is a dependency
27+
my @children_skip;
2728

2829
our $VERSION = '7.05_07';
2930
$VERSION = eval $VERSION; ## no critic [BuiltinFunctions::ProhibitStringyEval]
@@ -405,6 +406,11 @@ sub full_setup {
405406
MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC
406407
PERL FULLPERL
407408
);
409+
410+
# in generate_makefile - EUMM's with a PARENT skip these sections
411+
@children_skip = qw(
412+
install dist dist_basics dist_core distdir dist_test dist_ci
413+
);
408414
}
409415

410416
sub _has_cpan_meta_requirements {
@@ -488,44 +494,7 @@ END
488494
);
489495

490496
$self->makefile_preamble(\@ARGV, \%initial_att, \%configure_att);
491-
492-
# turn the SKIP array into a SKIPHASH hash
493-
for my $skip (@{$self->{SKIP} || []}) {
494-
$self->{SKIPHASH}{$skip} = 1;
495-
}
496-
delete $self->{SKIP}; # free memory
497-
if ($self->{PARENT}) {
498-
for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) {
499-
$self->{SKIPHASH}{$_} = 1;
500-
}
501-
}
502-
503-
# We run all the subdirectories now. They don't have much to query
504-
# from the parent, but the parent has to query them: if they need linking!
505-
unless ($self->{NORECURS}) {
506-
$self->eval_in_subdirs if @{$self->{DIR}};
507-
}
508-
509-
foreach my $section ( @MM_Sections ) {
510-
# Support for new foo_target() methods.
511-
my $method = $section;
512-
$method .= '_target' unless $self->can($method);
513-
514-
print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
515-
my($skipit) = $self->skipsection($section);
516-
if ($skipit) {
517-
push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
518-
} else {
519-
my(%a) = %{$self->{$section} || {}};
520-
push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
521-
push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
522-
push @{$self->{RESULT}}, $self->maketext_filter(
523-
$self->$method( %a )
524-
);
525-
}
526-
}
527-
528-
push @{$self->{RESULT}}, "\n# End.";
497+
$self->generate_makefile;
529498

530499
$self;
531500
}
@@ -575,6 +544,34 @@ sub extract_ARGV {
575544
}
576545
}
577546

547+
sub generate_makefile {
548+
my ($self) = @_;
549+
# turn the SKIP array into a SKIPHASH hash
550+
$self->{SKIPHASH}{$_} = 1 for @{$self->{SKIP} || []};
551+
delete $self->{SKIP}; # free memory
552+
if ($self->{PARENT}) { $self->{SKIPHASH}{$_} = 1 for @children_skip }
553+
# We run all the subdirectories now. They don't have much to query
554+
# from the parent, but the parent has to query them: if they need linking!
555+
$self->eval_in_subdirs if @{$self->{DIR}} and not $self->{NORECURS};
556+
foreach my $section ( @MM_Sections ) {
557+
print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
558+
if ($self->skipsection($section)){
559+
push @{$self->{RESULT}}, "\n# --- MakeMaker $section section skipped.";
560+
} else {
561+
my(%a) = %{$self->{$section} || {}};
562+
push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
563+
push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
564+
# Support new foo_target() methods.
565+
my $method = $section;
566+
$method .= '_target' unless $self->can($method);
567+
push @{$self->{RESULT}}, $self->maketext_filter(
568+
$self->$method( %a )
569+
);
570+
}
571+
}
572+
push @{$self->{RESULT}}, "\n# End.";
573+
}
574+
578575
sub extract_PARENT {
579576
my ($self) = @_;
580577
push @Parent, $self;

0 commit comments

Comments
 (0)