-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
-cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
- -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
+ -@if test -f miniperl$(EXE_EXT) ; then \
+ for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(CLEAN) $$x MAKE=$(MAKE) ; \
- done
+ done ; \
+ else \
+ sh $(CLEAN).sh ; \
+ fi
+ rm -f realclean.sh veryclean.sh
-@test ! -f ./miniperl$(EXE_EXT) || $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib mkppport --clean
# Some systems do not support "?", so keep these files separate.
-#!/bin/perl
+#!./miniperl
use strict;
use warnings;
if (-f "Makefile.PL") {
system("${run}../$depth/miniperl -I../$depth/lib Makefile.PL INSTALLDIRS=perl INSTALLMAN3DIR=none PERL_CORE=1 $passthru");
}
+ # Right. The reason for this little hack is that we're sitting inside
+ # a program run by ./miniperl, but there are tasks we need to perform
+ # when the 'realclean', 'distclean' or 'veryclean' targets are run.
+ # Unfortunately, they can be run *after* 'clean', which deletes
+ # ./miniperl
+ # So we do our best to leave a set of instructions identical to what
+ # we would do if we are run directly as 'realclean' etc
+ # Whilst we're perfect, unfortunately the targets we call are not, as
+ # some of them rely on a $(PERL) for their own distclean targets.
+ # But this always used to be a problem with the old /bin/sh version of
+ # this.
+ my $suffix = '.sh';
+ foreach my $clean_target ('realclean', 'veryclean') {
+ my $file = "../$depth/$clean_target$suffix";
+ open my $fh, '>>', $file or die "open $file: $!";
+ # Quite possible that we're being run in parallel here.
+ # Can't use Fcntl this early to get the LOCK_EX
+ flock $fh, 2 or warn "flock $file: $!";
+ if ($^O eq 'VMS') {
+ # Write out DCL here
+ } elsif ($^O eq 'MSWin32') {
+ # Might not need anything here.
+ } else {
+ print $fh <<"EOS";
+chdir ext/$pname
+if test ! -f $makefile -a -f Makefile.old; then
+ echo "Note: Using Makefile.old"
+ make -f Makefile.old $clean_target MAKE=$make $passthru
+else
+ if test ! -f $makefile ; then
+ echo "Warning: No Makefile!"
+ fi
+ make $clean_target MAKE=$make $passthru
+fi
+chdir ../$depth
+EOS
+ }
+ close $fh or die "close $file: $!";
+ }
}
if (not -f $makefile) {