diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-07-23 10:16:08 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-07-24 09:36:12 +0200 |
commit | 7afc975352a5b293c8c80f132f1e3d80fb349dd4 (patch) | |
tree | 6b9805b07d2de1565b99060c47540062c55d347e | |
parent | 727d4ce653261272b0d555f474cf1c25d9eda827 (diff) | |
download | perl-7afc975352a5b293c8c80f132f1e3d80fb349dd4.tar.gz |
Generate the lib/ cleanup rules in the Win32 Makefiles from MANIFEST.
-rw-r--r-- | regen/lib_cleanup.pl | 36 | ||||
-rw-r--r-- | t/porting/regen.t | 2 | ||||
-rw-r--r-- | win32/Makefile | 25 | ||||
-rw-r--r-- | win32/makefile.mk | 25 |
4 files changed, 65 insertions, 23 deletions
diff --git a/regen/lib_cleanup.pl b/regen/lib_cleanup.pl index 296724eb5f..c9d6e434bd 100644 --- a/regen/lib_cleanup.pl +++ b/regen/lib_cleanup.pl @@ -40,7 +40,7 @@ close $fh my %ignore; # Directories that the Makfiles should remove # With a special case already :-( -my %rmdir = ('lib/Unicode/Collate/Locale' => 1); +my %rmdir_s = my %rmdir = ('Unicode/Collate/Locale' => 1); FILE: foreach my $file (@ext) { @@ -96,11 +96,12 @@ foreach my $file (@ext) { if (!$libdirs{$prefix}) { # It is a directory that we will create. Ignore everything in it: ++$ignore{"/$prefix/"}; - ++$rmdir{"lib/$prefix"}; + ++$rmdir{$prefix}; + ++$rmdir_s{$prefix}; pop @parts; while (@parts) { $prefix .= '/' . shift @parts; - ++$rmdir{"lib/$prefix"}; + ++$rmdir{$prefix}; } next FILE; } @@ -121,14 +122,41 @@ sub edit_makefile_SH { qr/$start_re\n(?:\t-rmdir [^\n]+\n)+/sm, 'lib directory rmdir rules'); # Reverse sort ensures that any subdirectories are deleted first. + # The extensions themselves delete files with the MakeMaker generated clean + # targets. $contents =~ s{\0} {"$start\n" - . wrap(79, "\t-rmdir ", "\t-rmdir ", reverse sort keys %rmdir) + . wrap(79, "\t-rmdir ", "\t-rmdir ", + map {"lib/$_"} reverse sort keys %rmdir) . "\n"}e; $contents; } +sub edit_win32_makefile { + my ($desc, $contents) = @_; + my $start = "\t-del /f *.def *.map"; + my $start_re = quotemeta($start); + $contents = verify_contiguous($desc, $contents, + qr!$start_re\n(?:\t-if exist (\$\(LIBDIR\)\\\S+) rmdir /s /q \1\n)+!sm, + 'Win32 lib directory rmdir rules'); + # Win32 is (currently) using rmdir /s /q which deletes recursively + # (seems to be analogous to rm -r) so we don't explicitly list + # subdirectories to delete, and don't need to ensure that subdirectories are + # deleted before their parents. + # Might be able to rely on MakeMaker generated clean targets to clean + # everything, but not in a position to test this. + my $lines = join '', map { + tr!/!\\!; + "\t-if exist \$(LIBDIR)\\$_ rmdir /s /q \$(LIBDIR)\\$_\n" + } sort {lc $a cmp lc $b} keys %rmdir_s; + $contents =~ s/\0/$start\n$lines/; + $contents; +} + process('Makefile.SH', 'Makefile.SH', \&edit_makefile_SH, $TAP && '', $Verbose); +foreach ('win32/Makefile', 'win32/makefile.mk') { + process($_, $_, \&edit_win32_makefile, $TAP && '', $Verbose); +} # This must come last as it can exit early: if ($TAP && !-d '.git' && !-f 'lib/.gitignore') { diff --git a/t/porting/regen.t b/t/porting/regen.t index e05ea3ecde..7450613713 100644 --- a/t/porting/regen.t +++ b/t/porting/regen.t @@ -16,7 +16,7 @@ if ( $^O eq "VMS" ) { skip_all( "- regen.pl needs porting." ); } -my $tests = 24; # I can't see a clean way to calculate this automatically. +my $tests = 26; # I can't see a clean way to calculate this automatically. my %skip = ("regen_perly.pl" => [qw(perly.act perly.h perly.tab)], "regen/keywords.pl" => [qw(keywords.c keywords.h)], diff --git a/win32/Makefile b/win32/Makefile index 79b5e0fdbd..0583c81c7d 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -1187,57 +1187,64 @@ distclean: realclean -if exist $(LIBDIR)\Attribute rmdir /s /q $(LIBDIR)\Attribute -if exist $(LIBDIR)\autodie rmdir /s /q $(LIBDIR)\autodie -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B + -if exist $(LIBDIR)\Carp rmdir /s /q $(LIBDIR)\Carp -if exist $(LIBDIR)\CGI rmdir /s /q $(LIBDIR)\CGI - -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN -if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress + -if exist $(LIBDIR)\Config\Perl rmdir /s /q $(LIBDIR)\Config\Perl + -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data -if exist $(LIBDIR)\Devel rmdir /s /q $(LIBDIR)\Devel -if exist $(LIBDIR)\Digest rmdir /s /q $(LIBDIR)\Digest -if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode -if exist $(LIBDIR)\encoding rmdir /s /q $(LIBDIR)\encoding + -if exist $(LIBDIR)\Exporter rmdir /s /q $(LIBDIR)\Exporter -if exist $(LIBDIR)\ExtUtils\CBuilder rmdir /s /q $(LIBDIR)\ExtUtils\CBuilder -if exist $(LIBDIR)\ExtUtils\Command rmdir /s /q $(LIBDIR)\ExtUtils\Command -if exist $(LIBDIR)\ExtUtils\Constant rmdir /s /q $(LIBDIR)\ExtUtils\Constant -if exist $(LIBDIR)\ExtUtils\Liblist rmdir /s /q $(LIBDIR)\ExtUtils\Liblist -if exist $(LIBDIR)\ExtUtils\MakeMaker rmdir /s /q $(LIBDIR)\ExtUtils\MakeMaker + -if exist $(LIBDIR)\ExtUtils\ParseXS rmdir /s /q $(LIBDIR)\ExtUtils\ParseXS + -if exist $(LIBDIR)\ExtUtils\Typemaps rmdir /s /q $(LIBDIR)\ExtUtils\Typemaps -if exist $(LIBDIR)\File\Spec rmdir /s /q $(LIBDIR)\File\Spec -if exist $(LIBDIR)\Filter rmdir /s /q $(LIBDIR)\Filter -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash - -if exist $(LIBDIR)\I18N\LangTags rmdir /s /q $(LIBDIR)\I18N\LangTags + -if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP + -if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N -if exist $(LIBDIR)\inc rmdir /s /q $(LIBDIR)\inc - -if exist $(LIBDIR)\Module\Pluggable rmdir /s /q $(LIBDIR)\Module\Pluggable -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO -if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC + -if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON -if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List -if exist $(LIBDIR)\Locale rmdir /s /q $(LIBDIR)\Locale - -if exist $(LIBDIR)\Log rmdir /s /q $(LIBDIR)\Log -if exist $(LIBDIR)\Math rmdir /s /q $(LIBDIR)\Math -if exist $(LIBDIR)\Memoize rmdir /s /q $(LIBDIR)\Memoize -if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME -if exist $(LIBDIR)\Module rmdir /s /q $(LIBDIR)\Module - -if exist $(LIBDIR)\mro rmdir /s /q $(LIBDIR)\mro -if exist $(LIBDIR)\Net\FTP rmdir /s /q $(LIBDIR)\Net\FTP - -if exist $(LIBDIR)\Object rmdir /s /q $(LIBDIR)\Object -if exist $(LIBDIR)\Package rmdir /s /q $(LIBDIR)\Package -if exist $(LIBDIR)\Params rmdir /s /q $(LIBDIR)\Params -if exist $(LIBDIR)\Parse rmdir /s /q $(LIBDIR)\Parse + -if exist $(LIBDIR)\Perl rmdir /s /q $(LIBDIR)\Perl -if exist $(LIBDIR)\PerlIO rmdir /s /q $(LIBDIR)\PerlIO -if exist $(LIBDIR)\Pod\Perldoc rmdir /s /q $(LIBDIR)\Pod\Perldoc -if exist $(LIBDIR)\Pod\Simple rmdir /s /q $(LIBDIR)\Pod\Simple -if exist $(LIBDIR)\Pod\Text rmdir /s /q $(LIBDIR)\Pod\Text - -if exist $(LIBDIR)\re rmdir /s /q $(LIBDIR)\re -if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar + -if exist $(LIBDIR)\Search rmdir /s /q $(LIBDIR)\Search -if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys -if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP - -if exist $(LIBDIR)\Term\UI rmdir /s /q $(LIBDIR)\Term\UI + -if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term -if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test + -if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash -if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate + -if exist $(LIBDIR)\Unicode\Collate\Locale rmdir /s /q $(LIBDIR)\Unicode\Collate\Locale -if exist $(LIBDIR)\version rmdir /s /q $(LIBDIR)\version - -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS + -if exist $(LIBDIR)\VMS rmdir /s /q $(LIBDIR)\VMS -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API + -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS -cd $(PODDIR) && del /f *.html *.bat roffitall \ perl5193delta.pod perlaix.pod perlamiga.pod perlapi.pod \ perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod perldos.pod \ diff --git a/win32/makefile.mk b/win32/makefile.mk index 1a182cf6fb..ce0a655bcf 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1365,57 +1365,64 @@ distclean: realclean -if exist $(LIBDIR)\Attribute rmdir /s /q $(LIBDIR)\Attribute -if exist $(LIBDIR)\autodie rmdir /s /q $(LIBDIR)\autodie -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B + -if exist $(LIBDIR)\Carp rmdir /s /q $(LIBDIR)\Carp -if exist $(LIBDIR)\CGI rmdir /s /q $(LIBDIR)\CGI - -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN -if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress + -if exist $(LIBDIR)\Config\Perl rmdir /s /q $(LIBDIR)\Config\Perl + -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data -if exist $(LIBDIR)\Devel rmdir /s /q $(LIBDIR)\Devel -if exist $(LIBDIR)\Digest rmdir /s /q $(LIBDIR)\Digest -if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode -if exist $(LIBDIR)\encoding rmdir /s /q $(LIBDIR)\encoding + -if exist $(LIBDIR)\Exporter rmdir /s /q $(LIBDIR)\Exporter -if exist $(LIBDIR)\ExtUtils\CBuilder rmdir /s /q $(LIBDIR)\ExtUtils\CBuilder -if exist $(LIBDIR)\ExtUtils\Command rmdir /s /q $(LIBDIR)\ExtUtils\Command -if exist $(LIBDIR)\ExtUtils\Constant rmdir /s /q $(LIBDIR)\ExtUtils\Constant -if exist $(LIBDIR)\ExtUtils\Liblist rmdir /s /q $(LIBDIR)\ExtUtils\Liblist -if exist $(LIBDIR)\ExtUtils\MakeMaker rmdir /s /q $(LIBDIR)\ExtUtils\MakeMaker + -if exist $(LIBDIR)\ExtUtils\ParseXS rmdir /s /q $(LIBDIR)\ExtUtils\ParseXS + -if exist $(LIBDIR)\ExtUtils\Typemaps rmdir /s /q $(LIBDIR)\ExtUtils\Typemaps -if exist $(LIBDIR)\File\Spec rmdir /s /q $(LIBDIR)\File\Spec -if exist $(LIBDIR)\Filter rmdir /s /q $(LIBDIR)\Filter -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash - -if exist $(LIBDIR)\I18N\LangTags rmdir /s /q $(LIBDIR)\I18N\LangTags + -if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP + -if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N -if exist $(LIBDIR)\inc rmdir /s /q $(LIBDIR)\inc - -if exist $(LIBDIR)\Module\Pluggable rmdir /s /q $(LIBDIR)\Module\Pluggable -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO -if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC + -if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON -if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List -if exist $(LIBDIR)\Locale rmdir /s /q $(LIBDIR)\Locale - -if exist $(LIBDIR)\Log rmdir /s /q $(LIBDIR)\Log -if exist $(LIBDIR)\Math rmdir /s /q $(LIBDIR)\Math -if exist $(LIBDIR)\Memoize rmdir /s /q $(LIBDIR)\Memoize -if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME -if exist $(LIBDIR)\Module rmdir /s /q $(LIBDIR)\Module - -if exist $(LIBDIR)\mro rmdir /s /q $(LIBDIR)\mro -if exist $(LIBDIR)\Net\FTP rmdir /s /q $(LIBDIR)\Net\FTP - -if exist $(LIBDIR)\Object rmdir /s /q $(LIBDIR)\Object -if exist $(LIBDIR)\Package rmdir /s /q $(LIBDIR)\Package -if exist $(LIBDIR)\Params rmdir /s /q $(LIBDIR)\Params -if exist $(LIBDIR)\Parse rmdir /s /q $(LIBDIR)\Parse + -if exist $(LIBDIR)\Perl rmdir /s /q $(LIBDIR)\Perl -if exist $(LIBDIR)\PerlIO rmdir /s /q $(LIBDIR)\PerlIO -if exist $(LIBDIR)\Pod\Perldoc rmdir /s /q $(LIBDIR)\Pod\Perldoc -if exist $(LIBDIR)\Pod\Simple rmdir /s /q $(LIBDIR)\Pod\Simple -if exist $(LIBDIR)\Pod\Text rmdir /s /q $(LIBDIR)\Pod\Text - -if exist $(LIBDIR)\re rmdir /s /q $(LIBDIR)\re -if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar + -if exist $(LIBDIR)\Search rmdir /s /q $(LIBDIR)\Search -if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys -if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP - -if exist $(LIBDIR)\Term\UI rmdir /s /q $(LIBDIR)\Term\UI + -if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term -if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test + -if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash -if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate + -if exist $(LIBDIR)\Unicode\Collate\Locale rmdir /s /q $(LIBDIR)\Unicode\Collate\Locale -if exist $(LIBDIR)\version rmdir /s /q $(LIBDIR)\version - -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS + -if exist $(LIBDIR)\VMS rmdir /s /q $(LIBDIR)\VMS -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API + -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS -cd $(PODDIR) && del /f *.html *.bat roffitall \ perl5193delta.pod perlaix.pod perlamiga.pod perlapi.pod \ perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod perldos.pod \ |