Skip to content

Commit 7fe377d

Browse files
committed
Breakup MakeMaker->new: generate_makefile method
1 parent a0b9888 commit 7fe377d

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

lib/ExtUtils/MakeMaker.pm

+35-38
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_05';
2930
$VERSION = eval $VERSION; ## no critic [BuiltinFunctions::ProhibitStringyEval]
@@ -394,6 +395,11 @@ sub full_setup {
394395
MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC
395396
PERL FULLPERL
396397
);
398+
399+
# in generate_makefile - EUMM's with a PARENT skip these sections
400+
@children_skip = qw(
401+
install dist dist_basics dist_core distdir dist_test dist_ci
402+
);
397403
}
398404

399405
sub _has_cpan_meta_requirements {
@@ -477,44 +483,7 @@ END
477483
);
478484

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

519488
$self;
520489
}
@@ -564,6 +533,34 @@ sub extract_ARGV {
564533
}
565534
}
566535

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

0 commit comments

Comments
 (0)