This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Run lib/diagnostics.t during make test_porting
[perl5.git] / Makefile.SH
old mode 100644 (file)
new mode 100755 (executable)
index 58c4449..59e4786
@@ -1,4 +1,3 @@
-#! /bin/sh
 case $PERL_CONFIG_SH in
 '')
        if test -f config.sh
@@ -21,20 +20,6 @@ case $CROSS_NAME in
        ;;
 esac
 
-# H.Merijn Brand [17 Feb 2004]
-# This comment is just to ensure that Configure will find variables that
-# are removed/replaced in patches on blead, but are still needed in the
-# 5.8.x, 5.6.x and 5.005.x maintainance tracks.
-# metaconfig -m will scan all .SH files on this level (not deeper), and
-# not in x2p and other subfolders. This file is as good as any .SH
-# patch   references
-# #22227 $baserev
-# #22302 $yacc $byacc
-
-# H.Merijn Brand [30 Oct 2004]
-# Mentioned for the same reason for future reference
-# #23434 $d_strlcat $d_strlcpy
-
 : This forces SH files to create target in same directory as SH file.
 : This is so that make depend always knows where to find SH derivatives.
 case "$0" in
@@ -181,6 +166,7 @@ esac
 
 : Prepare dependency lists for Makefile.
 dynamic_list=' '
+dynamic_ext_re="lib/auto/re/re.$dlext"
 extra_dep=''
 for f in $dynamic_ext; do
     : the dependency named here will never exist
@@ -198,6 +184,8 @@ $this_target: lib/auto/List/Util/Util.$dlext" ;;
 $this_target: uni.data" ;;
        Text/ParseWords) extra_dep="$extra_dep
 $this_target: lib/auto/Scalar/Util.$dlext" ;;
+       SDBM_File) extra_dep="$extra_dep
+$this_target: lib/auto/Cwd/Cwd.$dlext" ;;
     esac
 done
 
@@ -218,16 +206,22 @@ done
 nonxs_list=' '
 for f in $nonxs_ext; do
     p=`echo "$f" | tr / -`
-    nonxs_list="$nonxs_list ext/$p/pm_to_blib"
+    for d in ext dist cpan; do
+       if test -d $d/$p; then
+           nonxs_list="$nonxs_list $d/$p/pm_to_blib"
+       fi
+    done
 done
 
 dtrace_h=''
 dtrace_o=''
+minidtrace_o=''
 case "$usedtrace" in
 define|true)
        dtrace_h='perldtrace.h' 
        $dtrace -G -s perldtrace.d -o perldtrace.tmp >/dev/null 2>&1 \
-               && rm -f perldtrace.tmp && dtrace_o='perldtrace$(OBJ_EXT)'
+               && rm -f perldtrace.tmp && dtrace_o='perldtrace$(OBJ_EXT)' \
+               && minidtrace_o='miniperldtrace$(OBJ_EXT)'
        ;;
 esac
 
@@ -302,8 +296,20 @@ LIB_EXT = $_a
 OBJ_EXT = $_o
 PATH_SEP = $p_
 
-#
+# Macros to invoke a copy of miniperl during the build.  Targets which
+# are built using these macros should depend on \$(MINIPERL_EXE)
+MINIPERL_EXE = miniperl\$(EXE_EXT)
+MINIPERL = \$(LDLIBPTH) \$(RUN) ./miniperl\$(EXE_EXT) -Ilib
+
+# Macros to invoke a copy of our fully operational perl during the build.
+PERL_EXE = perl\$(EXE_EXT)
+RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT)
+
+# Macros to run our tests
+RUN_TESTS = \$(LDLIBPTH) ./runtests
+
 dynamic_ext = $dynamic_list
+dynamic_ext_re = $dynamic_ext_re
 static_ext = $static_list
 nonxs_ext = $nonxs_list
 ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
@@ -311,7 +317,7 @@ DYNALOADER = DynaLoader\$(OBJ_EXT)
 
 libs = $perllibs $cryptlib
 
-public = perl\$(EXE_EXT) utilities translators
+public = \$(PERL_EXE) utilities translators
 
 shellflags = $shellflags
 
@@ -328,6 +334,7 @@ VALGRIND=valgrind
 DTRACE = $dtrace
 DTRACE_H = $dtrace_h
 DTRACE_O = $dtrace_o
+MINIDTRACE_O = $minidtrace_o
 
 FIRSTMAKEFILE = $firstmakefile
 
@@ -412,32 +419,20 @@ esac
 ## In the following dollars and backticks do not need the extra backslash.
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
-private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h
+private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h lib/buildcustomize.pl
 
 # Files to be built with variable substitution before miniperl
 # is available.
-sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
-       myconfig.SH writemain.SH pod/Makefile.SH
+sh = Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH pod/Makefile.SH
 
-shextract = Makefile cflags config.h makeaperl makedepend \
-       makedir myconfig writemain pod/Makefile
+shextract = Makefile cflags config.h makedepend makedir myconfig pod/Makefile
 
-# Files to be built with variable substitution after miniperl is
-# available.  Dependencies handled manually below (for now).
-
-pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
-       pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL
-
-# lib/lib.pm is not listed here because it has a rule of its own.
-plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
-       pod/pod2usage pod/podchecker pod/podselect
-
-addedbyconf = UU $(shextract) $(plextract) lib/lib.pm pstruct
+addedbyconf = UU $(shextract) pstruct
 
 # Unicode data files generated by mktables
-unidatafiles = lib/unicore/Canonical.pl lib/unicore/Exact.pl \
-       lib/unicore/Properties lib/unicore/Decomposition.pl \
-       lib/unicore/CombiningClass.pl lib/unicore/Name.pl lib/unicore/PVA.pl
+unidatafiles = lib/unicore/Decomposition.pl lib/unicore/TestProp.pl \
+       lib/unicore/CombiningClass.pl lib/unicore/Name.pl \
+       lib/unicore/Heavy.pl lib/unicore/mktables.lst
 
 # Directories of Unicode data files generated by mktables
 unidatadirs = lib/unicore/To lib/unicore/lib
@@ -446,30 +441,31 @@ h1 = EXTERN.h INTERN.h XSUB.h av.h $(CONFIGH) cop.h cv.h dosish.h
 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
 h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
 h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
-h5 = utf8.h warnings.h mydtrace.h
+h5 = utf8.h warnings.h mydtrace.h op_reg_common.h l1_char_class_tab.h
 h = $(h1) $(h2) $(h3) $(h4) $(h5)
 
 c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro.c perl.c
 c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c
-c3 = taint.c toke.c util.c deb.c run.c universal.c pad.c globals.c
+c3 = taint.c toke.c util.c deb.c run.c universal.c pad.c globals.c keywords.c
 c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c
 c5 = $(madlysrc) $(mallocsrc)
 
-c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c perlmain.c opmini.c perlmini.c
+c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c opmini.c perlmini.c
 
 obj0 = op$(OBJ_EXT) perl$(OBJ_EXT)
-obj1 = $(madlyobj) $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro$(OBJ_EXT)
+obj1 = $(madlyobj) $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro$(OBJ_EXT) keywords$(OBJ_EXT)
 obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT)
 obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT)
 
-mini_obj =  $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
+minindt_obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
+mini_obj = $(minindt_obj) $(MINIDTRACE_O)
 ndt_obj = $(obj0) $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
 obj = $(ndt_obj) $(DTRACE_O)
 
-perltoc_pod_prereqs = extra.pods pod/perlapi.pod pod/perldelta.pod pod/perlintern.pod pod/perlmodlib.pod
+perltoc_pod_prereqs = extra.pods pod/perl51310delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
 generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs)
 
-Icwd = -Iext/Cwd
+Icwd = -Idist/Cwd -Idist/Cwd/lib
 
 lintflags = \
     -b \
@@ -538,24 +534,50 @@ splintfiles = $(c1)
 .c.s:
        $(CCCMDSRC) -S $*.c
 
-all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) miniperl $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
+all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
        @echo " ";
        @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
 
 .PHONY: all translators utilities
 
-lib/Config_git.pl git_version.h: miniperl$(EXE_EXT) make_patchnum.pl
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_patchnum.pl
+# Both git_version.h and lib/Config_git.pl are built
+# by make_patchnum.pl.
+git_version.h: lib/Config_git.pl
+
+lib/Config_git.pl: $(MINIPERL_EXE) make_patchnum.pl
+       $(MINIPERL) make_patchnum.pl
 
 # make sure that we recompile perl.c if the git version changes
 perl$(OBJ_EXT): git_version.h
 
-translators:   miniperl$(EXE_EXT) $(CONFIGPM) $(dynamic_ext) FORCE
-       @echo " "; echo "       Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
+!NO!SUBS!
 
-utilities:     miniperl$(EXE_EXT) $(CONFIGPM) $(plextract) lib/lib.pm FORCE
-       @echo " "; echo "       Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
+# Making utilities and translators require Cwd.  If we have dynamic
+# loading, we only need miniperl and Cwd.$dlext.  If we have static
+# loading, we need to build perl first.
+case "$usedl" in
+define)
+    util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE'
+     x2p_deps='$(MINIPERL_EXE) $(CONFIGPM) $(dynamic_ext) FORCE'
+    ;;
+*)  util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
+     x2p_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
+    ;;
+esac
+
+$spitshell >>$Makefile <<!GROK!THIS!
+translators:   $x2p_deps
+       @echo " "; echo "       Making x2p stuff"; cd x2p; \$(LDLIBPTH) \$(MAKE) all
+
+x2p/s2p: $x2p_deps
+       cd x2p; \$(LDLIBPTH) \$(MAKE) s2p
 
+utilities:     $util_deps
+       @echo " "; echo "       Making utilities"; cd utils; \$(LDLIBPTH) \$(MAKE) all
+
+!GROK!THIS!
+
+$spitshell >>$Makefile <<'!NO!SUBS!'
 
 # This is now done by installman only if you actually want the man pages.
 #      @echo " "; echo "       Making docs"; cd pod; $(MAKE) all;
@@ -566,41 +588,52 @@ utilities:        miniperl$(EXE_EXT) $(CONFIGPM) $(plextract) lib/lib.pm FORCE
 FORCE:
        @sh -c true
 !NO!SUBS!
-$spitshell >>$Makefile <<!GROK!THIS!
 
-# We do a copy of the op.c instead of a symlink because gcc gets huffy
+for file in op perl; do
+    if $issymlink $file.c; then
+        $spitshell >>$Makefile <<!GROK!THIS!
+
+# We do a copy of the $file.c instead of a symlink because gcc gets huffy
 # if we have a symlink forest to another disk (it complains about too many
 # levels of symbolic links, even if we have only two)
 
-opmini.c: op.c
-       \$(RMS) opmini.c
-       \$(CPS) op.c opmini.c
+${file}mini.c: $file.c
+       \$(RMS) ${file}mini.c
+       \$(CPS) ${file}.c ${file}mini.c
+!GROK!THIS!
+    else
+        $spitshell >>$Makefile <<!GROK!THIS!
 
-opmini\$(OBJ_EXT): opmini.c
-       \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
+${file}mini.c: $file.c
+       \$(RMS) ${file}mini.c
+       \$(LNS) ${file}.c ${file}mini.c
+!GROK!THIS!
+    fi
 
-perlmini.c: perl.c
-       \$(RMS) perlmini.c
-       \$(CPS) perl.c perlmini.c
+    $spitshell >>$Makefile <<!GROK!THIS!
 
-perlmini\$(OBJ_EXT): perlmini.c
-       \$(CCCMD) \$(PLDLFLAGS) $DPERL_IS_MINIPERL perlmini.c
+${file}mini\$(OBJ_EXT): ${file}mini.c
+       \$(CCCMD) \$(PLDLFLAGS) $DPERL_IS_MINIPERL $DPERL_EXTERNAL_GLOB ${file}mini.c
+!GROK!THIS!
+done
 
-globals\$(OBJ_EXT): uudmap.h bitcount.h
+$spitshell >>$Makefile <<'!NO!SUBS!'
 
-uudmap.h bitcount.h: generate_uudmap\$(HOST_EXE_EXT)
-       \$(RUN) ./generate_uudmap\$(HOST_EXE_EXT) uudmap.h bitcount.h
+globals$(OBJ_EXT): uudmap.h bitcount.h
 
-generate_uudmap\$(HOST_EXE_EXT): generate_uudmap\$(OBJ_EXT)
-       \$(CC) -o generate_uudmap\$(EXE_EXT) \$(LDFLAGS) generate_uudmap\$(OBJ_EXT) \$(libs)
+uudmap.h: bitcount.h
+
+bitcount.h: generate_uudmap$(HOST_EXE_EXT)
+       $(RUN) ./generate_uudmap$(HOST_EXE_EXT) uudmap.h bitcount.h
+
+generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
+       $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
 
-!GROK!THIS!
-$spitshell >>$Makefile <<'!NO!SUBS!'
 miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
        $(CCCMD) $(PLDLFLAGS) $*.c
 
-perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
-       sh writemain $(DYNALOADER) $(static_ext) > perlmain.c
+perlmain.c: $(MINIPERL_EXE) lib/ExtUtils/Miniperl.pm
+       $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(@ARGV)' DynaLoader $(static_ext) > perlmain.c
 
 perlmain$(OBJ_EXT): perlmain.c
        $(CCCMD) $(PLDLFLAGS) $*.c
@@ -655,7 +688,7 @@ LIBPERLEXPORT               = perl.exp
                ;;
        *)      
                $spitshell >>$Makefile <<'!NO!SUBS!'
-MINIPERLEXP            = miniperl$(EXE_EXT)
+MINIPERLEXP            = $(MINIPERL_EXE)
 
 PERLEXPORT             = perl.exp
 
@@ -713,9 +746,12 @@ mydtrace.h: $(DTRACE_H)
        case "$dtrace_o" in
        ?*)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-$(DTRACE_O): perldtrace.d
+$(DTRACE_O): perldtrace.d $(ndt_obj)
        $(DTRACE) -G -s perldtrace.d -o $(DTRACE_O) $(ndt_obj)
 
+$(MINIDTRACE_O): perldtrace.d $(minindt_obj)
+       $(DTRACE) -G -s perldtrace.d -o $(MINIDTRACE_O) $(minindt_obj)
+
 !NO!SUBS!
                ;;
     esac
@@ -763,8 +799,8 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT)
        case "${osname}${osvers}" in
        aix*|beos*)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
-       $(CC) -o miniperl$(EXE_EXT) $(CLDFLAGS) \
+$(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
+       $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) \
            $(mini_obj) \
            miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
        $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
@@ -772,8 +808,8 @@ miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlm
                ;;
        next4*)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) perlmini$(OBJ_EXT) opmini$(OBJ_EXT)
-       $(CC) -o miniperl$(EXE_EXT) $(mini_obj) \
+$(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) perlmini$(OBJ_EXT) opmini$(OBJ_EXT)
+       $(CC) -o $(MINIPERL_EXE) $(mini_obj) \
            miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
        $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
 !NO!SUBS!
@@ -792,9 +828,9 @@ NAMESPACEFLAGS = -force_flat_namespace
                    ;;
                esac
                $spitshell >>$Makefile <<'!NO!SUBS!'
-miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
+$(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
        -@rm -f miniperl.xok
-       $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o miniperl$(EXE_EXT) \
+       $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
            $(mini_obj) \
            miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
        $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
@@ -802,9 +838,9 @@ miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlm
                ;;
        *)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
+$(MINIPERL_EXE): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
        -@rm -f miniperl.xok
-       $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl$(EXE_EXT) \
+       $(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
            $(mini_obj) \
            miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(libs)
        $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
@@ -814,19 +850,19 @@ miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(mini_obj) opmini$(OBJ_EXT) perlm
 
        $spitshell >>$Makefile <<'!NO!SUBS!'
 
-perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
+$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
        -@rm -f miniperl.xok
        $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 # Purify/Quantify Perls.
 
-pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
+pure$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
        $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
-purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
+purecov$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
        $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
-quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
+quant$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
        $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 # Valgrind perl (currently Linux only)
@@ -929,9 +965,9 @@ case "${osname}" in
 catamount)
 $spitshell >>$Makefile <<!GROK!THIS!
 .PHONY: makeppport
-makeppport: miniperl\$(EXE_EXT) \$(CONFIGPM)
+makeppport: \$(MINIPERL_EXE) \$(CONFIGPM)
        -@for f in Makefile.PL PPPort_pm.PL PPPort_xs.PL ppport_h.PL; do \
-       (cd ext/Devel-PPPort && `pwd`/run.sh ../../miniperl$(EXE_EXT) -I../../lib \$\$f); \
+       (cd ext/Devel-PPPort && `pwd`/run.sh ../../$(MINIPERL_EXE) -I../../lib \$\$f); \
        done
 
 !GROK!THIS!
@@ -939,8 +975,8 @@ makeppport: miniperl\$(EXE_EXT) \$(CONFIGPM)
 *)
 $spitshell >>$Makefile <<'!NO!SUBS!'
 .PHONY: makeppport
-makeppport: miniperl$(EXE_EXT) $(CONFIGPM) $(nonxs_ext)
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib $(Icwd) mkppport
+makeppport: $(MINIPERL_EXE) $(CONFIGPM) $(nonxs_ext)
+       $(MINIPERL) $(Icwd) mkppport
 
 !NO!SUBS!
 ;;
@@ -949,51 +985,45 @@ esac
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
 .PHONY: preplibrary
-preplibrary: miniperl$(EXE_EXT) $(CONFIGPM) lib/lib.pm lib/re.pm $(PREPLIBRARY_LIBPERL)
-
-$(CONFIGPM_FROM_CONFIG_SH) $(CONFIGPOD): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary lib/Config_git.pl
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib configpm
+preplibrary: $(MINIPERL_EXE) $(CONFIGPM) $(PREPLIBRARY_LIBPERL)
 
-lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl $(CONFIGPM)
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) minimod.pl > lib/ExtUtils/Miniperl.pm
+$(CONFIGPM_FROM_CONFIG_SH): $(CONFIGPOD)
 
-lib/re.pm: ext/re/re.pm
-       @-rm -f $@
-       cp ext/re/re.pm lib/re.pm
+$(CONFIGPOD): config.sh $(MINIPERL_EXE) configpm Porting/Glossary lib/Config_git.pl
+       $(MINIPERL) configpm
 
-$(plextract):  miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p $(dynamic_ext)
-       @-rm -f $@
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -I"`pwd`/lib" $@.PL
+lib/ExtUtils/Miniperl.pm: miniperlmain.c $(MINIPERL_EXE) minimod.pl $(CONFIGPM)
+       $(MINIPERL) minimod.pl > lib/ExtUtils/Miniperl.pm
 
-x2p/s2p: miniperl$(EXE_EXT) $(CONFIGPM) $(dynamic_ext) x2p/s2p.PL
-       cd x2p; $(LDLIBPTH) $(MAKE) s2p
+lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl
+       $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl
 
-lib/lib.pm:    miniperl$(EXE_EXT) $(CONFIGPM)
-       @-rm -f $@
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib $(Icwd) lib/lib_pm.PL
+unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data
 
-unidatafiles $(unidatafiles): uni.data
+uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
+       $(MINIPERL) $(Icwd) lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
+#      Commented out so always runs, mktables looks at far more files than we
+#      can in this makefile to decide if needs to run or not
+#      touch uni.data
 
-uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
-       cd lib/unicore && $(LDLIBPTH) $(RUN) ../../miniperl$(EXE_EXT) -I../../lib mktables -w
-       touch uni.data
-
-# perl$(EXE_EXT) and ext because buildtoc uses Text::Wrap uses re
+# $(PERL_EXE) and ext because buildtoc uses Text::Wrap uses re
 # But also this ensures that all extensions are built before we try to scan
 # them, which picks up Devel::PPPort's documentation.
-pod/perltoc.pod: $(perltoc_pod_prereqs) perl$(EXE_EXT) $(ext) pod/buildtoc
-       $(LDLIBPTH) $(RUN) ./perl$(EXE_EXT) -f -Ilib pod/buildtoc --build-toc -q
+pod/perltoc.pod: $(perltoc_pod_prereqs)  $(PERL_EXE) $(ext) pod/buildtoc
+       $(RUN_PERL) -f -Ilib pod/buildtoc --build-toc -q
+
+pod/perlapi.pod: pod/perlintern.pod
 
-pod/perlapi.pod pod/perlintern.pod: miniperl$(EXE_EXT) autodoc.pl embed.fnc
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib autodoc.pl
+pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc
+       $(MINIPERL) autodoc.pl
 
-pod/perlmodlib.pod: miniperl$(EXE_EXT) pod/perlmodlib.PL MANIFEST
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib $(Icwd) pod/perlmodlib.PL -q
+pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
+       $(MINIPERL) $(Icwd) pod/perlmodlib.PL -q
 
-pod/perldelta.pod: pod/perl5110delta.pod
-       $(LNS) perl5110delta.pod pod/perldelta.pod
+pod/perl51310delta.pod: pod/perldelta.pod
+       $(LNS) perldelta.pod pod/perl51310delta.pod
 
-extra.pods: miniperl$(EXE_EXT)
+extra.pods: $(MINIPERL_EXE)
        -@test ! -f extra.pods || rm -f `cat extra.pods`
        -@rm -f extra.pods
        -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
@@ -1002,21 +1032,18 @@ extra.pods: miniperl$(EXE_EXT)
            echo "pod/perl"$$nx".pod" >> extra.pods ; \
        done
 
-extras.make: perl$(EXE_EXT)
-       -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) $(RUN) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
+extras.make: $(PERL_EXE)
+       -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
 
-extras.test: perl$(EXE_EXT)
-       -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) $(RUN) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
+extras.test: $(PERL_EXE)
+       -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
 
-extras.install: perl$(EXE_EXT)
-       -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) $(RUN) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
+extras.install: $(PERL_EXE)
+       -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
 
 .PHONY: install install-strip install-all install-verbose install-silent \
        no-install install.perl install.man install.html
 
-META.yml:      Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib Porting/makemeta
-
 install-strip:
        $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
 
@@ -1036,24 +1063,24 @@ no-install:
 INSTALL_DEPENDENCE = all
 
 install.perl:  $(INSTALL_DEPENDENCE) installperl
-       $(LDLIBPTH) $(RUN) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
+       $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
        -@test ! -s extras.lst || $(MAKE) extras.install
 
 install.man:   all installman
-       $(LDLIBPTH) $(RUN) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
+       $(RUN_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
 
 # XXX Experimental. Hardwired values, but useful for testing.
 # Eventually Configure could ask for some of these values.
 install.html: all installhtml
        -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
-       $(LDLIBPTH) $(RUN) ./perl installhtml   \
+       $(RUN_PERL) installhtml   \
       --podroot=. --podpath=. --recurse  \
       --htmldir=$(privlib)/html   \
       --htmlroot=$(privlib)/html  \
       --splithead=pod/perlipc     \
       --splititem=pod/perlfunc    \
       --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
-      --ignore=Porting/Maintainers.pm,Porting/patching.pod,Porting/pumpkin.pod,Porting/repository.pod \
+      --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
       --verbose
 
 
@@ -1080,9 +1107,7 @@ perly.c: perly.y
 perly.h: perly.y
        -@sh -c true
 
-# No compat3.sym here since and including the 5.004_50.
-# No interp.sym since 5.005_03.
-SYM  = global.sym globvar.sym perlio.sym pp.sym
+SYM  = global.sym globvar.sym perlio.sym
 
 SYMH = perlvars.h intrpvar.h
 
@@ -1091,9 +1116,7 @@ CHMOD_W = chmod +w
 # The following files are generated automatically
 #      embed.pl:       proto.h embed.h embedvar.h global.sym
 #                      perlapi.h perlapi.c 
-# [* embed.pl needs pp.sym generated by opcode.pl! *]
-#      keywords.pl:    keywords.h
-#      opcode.pl:      opcode.h opnames.h pp_proto.h pp.sym
+#      opcode.pl:      opcode.h opnames.h pp_proto.h
 #      regcomp.pl:     regnodes.h
 #      warnings.pl:    warnings.h lib/warnings.pm
 # The correct versions should be already supplied with the perl kit,
@@ -1103,7 +1126,7 @@ CHMOD_W = chmod +w
 # with your existing copy of perl
 # (make regen_headers is kept for backwards compatibility)
 
-AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
+AUTOGEN_FILES = opcode.h opnames.h pp_proto.h proto.h \
                embed.h embedvar.h global.sym \
                perlapi.h perlapi.c regnodes.h \
                warnings.h lib/warnings.pm
@@ -1116,7 +1139,13 @@ regen:   FORCE
 regen_headers: FORCE
        -perl regen.pl -v
 
-regen_all: regen
+regen_meta:  META.yml
+
+META.yml:   FORCE
+       PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta
+
+
+regen_all: regen regen_meta
 
 .PHONY:        manisort manicheck
 
@@ -1137,17 +1166,17 @@ manicheck:      FORCE
 #
 # DynaLoader may be needed for extensions that use Makefile.PL.
 
-$(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE $(nonxs_ext)
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
+$(DYNALOADER): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE $(nonxs_ext)
+       $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
 
-d_dummy $(dynamic_ext):        miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
+d_dummy $(dynamic_ext):        $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT)
+       $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
 
-s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
+s_dummy $(static_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
+       $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
 
-n_dummy $(nonxs_ext):  miniperl$(EXE_EXT) preplibrary FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+n_dummy $(nonxs_ext):  $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE
+       $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
 !NO!SUBS!
 
 $spitshell >>$Makefile <<EOF
@@ -1158,7 +1187,7 @@ $spitshell >>$Makefile <<'!NO!SUBS!'
 
 .PHONY: printconfig
 printconfig:
-       @eval `$(LDLIBPTH) $(RUN) ./perl -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
+       @eval `$(RUN_PERL) -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
 
 .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
        realclean _realcleaner clobber _clobber \
@@ -1195,9 +1224,8 @@ _mopup:
        -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
        -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
        -rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
-       -rm -f perl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
-       -rm -f opcode.h-old opnames.h-old pp.sym-old pp_proto.h-old
-       -rm -f config.arch config.over $(DTRACE_H)
+       -rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
+       -rm -f config.arch config.over $(DTRACE_H) runtests
 
 # Do not 'make _tidy' directly.
 _tidy:
@@ -1206,7 +1234,7 @@ _tidy:
        -cd x2p; $(LDLIBPTH) $(MAKE) clean
        -rm -f lib/Config_git.pl git_version.h
        -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
+       $(MINIPERL) make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
        done
 
 _cleaner1:
@@ -1214,21 +1242,24 @@ _cleaner1:
        -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
        -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
        -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
-       -@if test -f miniperl$(EXE_EXT) ; then \
+       -@if test -f $(MINIPERL_EXE) ; then \
        for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
+       $(MINIPERL) make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
        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
+       -for file in `find cpan dist ext -name ppport.h` ; do rm -f $$file; done
+
+# Dear POSIX, thanks for making the default to xargs to be
+# run once if nothhing is passed in. It is such a great help.
 
 # Some systems do not support "?", so keep these files separate.
 _cleaner2:
        -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
        rm -f core *perl.core t/core t/*perl.core core.* t/core.*
-       rm -f t/misctmp* t/forktmp* t/tmp* t/c t/perl$(EXE_EXT) t/rantests
+       rm -f t/misctmp* t/forktmp* t/tmp* t/c t/$(PERL_EXE) t/rantests
        rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
        rm -rf $(addedbyconf)
        rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
@@ -1238,7 +1269,7 @@ _cleaner2:
        rm -f lib/.exists lib/*/.exists lib/*/*/.exists
        rm -f h2ph.man pstruct
        rm -rf .config
-       rm -f preload lib/re.pm
+       rm -f preload
        rm -rf lib/Encode lib/Compress lib/Hash lib/re
        rm -rf lib/TAP lib/Module/Pluggable lib/App
        rm -rf lib/mro
@@ -1247,17 +1278,39 @@ _cleaner2:
        rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT)
        rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX)
        rm -fr lib/B
-       -rmdir lib/Data
-       -rmdir lib/Filter/Util lib/IO/Socket
-       -rmdir lib/List lib/MIME lib/Scalar lib/Sys
-       -rmdir lib/threads lib/XS
-       -rmdir lib/CPANPLUS/Dist/Build/t/dummy-*
-       -rmdir lib/CPANPLUS/t/dummy-cpanplus lib/CPANPLUS/t/dummy-localmirror
+       rm -fr lib/CPAN lib/CPANPLUS
+       rm -fr lib/ExtUtils/CBuilder
+       -rmdir cpan/CPANPLUS-Dist-Build/t/dummy-cpanplus cpan/CPANPLUS/t/dummy-cpanplus cpan/CPANPLUS/t/dummy-localmirror
+       -rmdir ext/B/lib
+       -rmdir lib/Archive/Tar lib/Archive lib/Attribute
+       -rmdir lib/CGI
+       -rmdir lib/Data lib/Devel lib/Digest
+       -rmdir lib/ExtUtils/Command lib/ExtUtils/Constant lib/ExtUtils/Liblist lib/ExtUtils/MakeMaker
+       -rmdir lib/File/Spec lib/Filter/Util lib/Filter
+       -rmdir lib/I18N/LangTags lib/IO/Socket lib/IO lib/IPC
+       -rmdir lib/List/Util lib/List
+       -rmdir lib/Locale/Maketext lib/Locale
+       -rmdir lib/Log/Message lib/Log
+       -rmdir lib/Math/Big* lib/Math
+       -rmdir lib/Memoize lib/MIME
+       -rmdir lib/Module/Build/Platform lib/Module/Build lib/Module/Load lib/Module
+       -rmdir lib/Net/FTP lib/Object
+       -rmdir lib/Parse/CPAN lib/Parse
+       -rmdir lib/PerlIO/via lib/PerlIO
+       -rmdir lib/Package lib/Params
+       -rmdir lib/Pod/Perldoc lib/Pod/Simple lib/Pod/Text
+       -rmdir lib/Sys lib/Scalar/Util lib/Scalar
+       -rmdir lib/Term/UI lib/Thread lib/Tie/Hash
+       -rmdir lib/Test/Builder/Tester lib/Test/Builder lib/Test
+       -rmdir lib/Unicode/Collate
+       -rmdir lib/XS/APItest lib/XS
+       -rmdir lib/inc/latest lib/inc
+       -rmdir lib/autodie/exception lib/autodie lib/encoding lib/threads
        -rm -f lib/ExtUtils/CBuilder/t/libcompilet.dll.a
        -rm -f lib/ExtUtils/ParseXS/t/libXSTest.dll.a
 
 _realcleaner:
-       @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
+       @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=distclean
        @$(LDLIBPTH) $(MAKE) _cleaner2
 
 _verycleaner:
@@ -1286,70 +1339,58 @@ $(FIRSTMAKEFILE):       README $(MAKEDEPEND)
 config.h: config_h.SH config.sh
        $(SHELL) config_h.SH
 
-# When done, touch perlmain.c so that it doesn't get remade each time.
 .PHONY: depend
 depend: makedepend
        sh ./makedepend MAKE=$(MAKE)
-       - test -s perlmain.c && touch perlmain.c
        cd x2p; $(MAKE) depend
 
 # Cannot postpone this until $firstmakefile is ready ;-)
 makedepend: makedepend.SH config.sh
        sh ./makedepend.SH
 
-.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
-       test_tty test-tty _test_tty test_notty test-notty _test_notty \
+runtests: runtests.SH config.sh
+       sh ./runtests.SH
+
+.PHONY: test check test_prep test_prep_nodll test_prep_pre \
+       test_prep_reonly test_tty test-tty test_notty test-notty \
        utest ucheck test.utf8 check.utf8 test.torture torturetest \
        test.utf16 check.utf16 utest.utf16 ucheck.utf16 \
        test.third check.third utest.third ucheck.third test_notty.third \
        test.deparse test_notty.deparse test_harness test_harness_notty \
-       minitest coretest test.taintwarn test-reonly
+       minitest coretest test.taintwarn test-reonly _test
+
+_test:
+       echo >&2 The _test target is deprecated. Please upgrade your smoker
+       PERL=./perl $(RUN_TESTS) choose
 
 # Cannot delegate rebuilding of t/perl to make
 # to allow interlaced test and minitest
 
-TESTFILE=TEST
-
-_test_prep:
-       cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
-
 # Architecture-neutral stuff:
 
 test_prep_pre: preplibrary utilities $(nonxs_ext)
 
-test_prep: test_prep_pre miniperl$(EXE_EXT) $(unidatafiles) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
-       PERL=./perl $(MAKE) _test_prep
-
-_test_tty:
-       cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) $(TEST_FILES) </dev/tty
-
-_test_notty:
-       cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) $(TEST_FILES)
+test_prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) $(dynamic_ext) $(TEST_PERL_DLL) runtests x2p/s2p $(generated_pods)
+       cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
 
-# The second branch is for testing without a tty or controlling terminal,
-# see t/op/stat.t
-_test:
-       if (true </dev/tty) >/dev/null 2>&1; then \
-         $(MAKE) TEST_ARGS='$(TEST_ARGS)' TESTFILE=$(TESTFILE) _test_tty   ; \
-       else \
-         $(MAKE) TEST_ARGS='$(TEST_ARGS)' TESTFILE=$(TESTFILE) _test_notty ; \
-       fi
-       @echo "Ran tests" > t/rantests
+test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL)
+       $(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
+       cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
 
 test check: test_prep
-       PERL=./perl $(MAKE) _test
+       $(RUN_TESTS) choose
 
 test_tty: test_prep
-       PERL=./perl $(MAKE) _test_tty
+       $(RUN_TESTS) tty
 
 test_notty: test_prep
-       PERL=./perl $(MAKE) _test_notty
+       $(RUN_TESTS) no-tty
 
 utest ucheck test.utf8 check.utf8: test_prep
-       PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
+       TEST_ARGS=-utf8 $(RUN_TESTS) choose
 
 coretest: test_prep
-       PERL=./perl TEST_ARGS=-core $(MAKE) _test
+       TEST_ARGS=-core $(RUN_TESTS) choose
 
 test-prep:     test_prep
 
@@ -1360,85 +1401,89 @@ test-notty:     test_notty
 # Torture testing
 
 test.torture torturetest:      test_prep
-       PERL=./perl TEST_ARGS=-torture $(MAKE) _test
+       TEST_ARGS=-torture $(RUN_TESTS) choose
 
 # Targets for UTF16 testing:
 
 minitest.utf16: minitest.prep
-       - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
-               && $(LDLIBPTH) $(RUN) ./perl TEST -minitest -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
+       - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \
+               && $(RUN_PERL) TEST -minitest -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
 
 test.utf16 check.utf16: test_prep
-       PERL=./perl $(MAKE) TEST_ARGS=-utf16 _test
+       TEST_ARGS=-utf16 $(RUN_TESTS) choose
 
 utest.utf16 ucheck.utf16: test_prep
-       PERL=./perl $(MAKE) TEST_ARGS="-utf8 -utf16" _test
+       TEST_ARGS="-utf8 -utf16" $(RUN_TESTS) choose
 
 # Targets for valgrind testing:
 
 test_prep.valgrind: test_prep perl.valgrind
-       PERL=./perl $(MAKE) _test_prep
 
 test.valgrind check.valgrind:  test_prep perl.valgrind.config
-       PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(MAKE) _test
+       PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(RUN_TESTS) choose
 
 utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config
-       PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
+       PERL_VALGRIND=1 TEST_ARGS=-utf8 $(RUN_TESTS) choose
 
 test_notty.valgrind: test_prep.valgrind perl.valgrind.config
-       PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
+       PERL_VALGRIND=1 $(RUN_TESTS) no-tty
 
 # Targets for Third Degree testing.
 
 test_prep.third: test_prep perl.third
-       PERL=./perl.third $(MAKE) _test_prep
+       cd t && (rm -f ./perl.third$(EXE_EXT); $(LNS) ../perl.third$(EXE_EXT) perl.third(EXE_EXT))
 
 test.third check.third:        test_prep.third perl.third
-       PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
+       PERL=./perl.third PERL_3LOG=1 $(RUN_TESTS) choose
 
 utest.third ucheck.third: test_prep.third perl.third
-       PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
+       PERL=./perl.third PERL_3LOG=1 TEST_ARGS=-utf8 $(RUN_TESTS) choose
 
 test_notty.third: test_prep.third perl.third
-       PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
+       PERL=./perl.third PERL_3LOG=1 $(RUN_TESTS) choose
 
 # Targets for Deparse testing.
 
 test.deparse:  test_prep
-       PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
+       TEST_ARGS=-deparse $(RUN_TESTS) choose
 
 test_notty.deparse:    test_prep
-       PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
+       TEST_ARGS=-deparse $(RUN_TESTS) no-tty
 
 # Targets to run the test suite with -t
 
 test.taintwarn:        test_prep
-       PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
+       TEST_ARGS=-taintwarn $(RUN_TESTS) choose
 
 minitest.prep:
-       -@test -f lib/lib.pm && test -f lib/Config.pm || \
-         $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
+       -@test -f lib/Config.pm || $(MAKE) lib/Config.pm $(unidatafiles)
        @echo " "
        @echo "You may see some irrelevant test failures if you have been unable"
-       @echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
+       @echo "to build lib/Config.pm, or the Unicode data files."
        @echo " "
 
 # Can't depend on lib/Config.pm because that might be where miniperl
 # is crashing.
-minitest: miniperl$(EXE_EXT) lib/re.pm minitest.prep
-       - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
-               && $(LDLIBPTH) $(RUN) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t op/*.t uni/*.t </dev/tty
+minitest: $(MINIPERL_EXE) minitest.prep
+       - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \
+               && $(RUN_PERL) TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t op/*.t uni/*.t </dev/tty
 
 # Test via harness
 
 test_harness: test_prep
-       PERL=./perl $(MAKE) TESTFILE=harness _test
+       TESTFILE=harness $(RUN_TESTS) choose
 
 test_harness_notty: test_prep
-       PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
+       HARNESS_NOTTY=1 TESTFILE=harness $(RUN_TESTS) choose
+
+test-reonly: test_prep_reonly
+       TEST_ARGS='-re \bre\/' TESTFILE=harness $(RUN_TESTS) choose
 
-test-reonly: test_prep
-       PERL=./perl TEST_ARGS='-re \\bre\\/' $(MAKE) TESTFILE=harness _test
+
+# Porting tests (well-formedness of pod, manifest, etc)
+
+test_porting: test_prep
+       cd t && $(RUN_PERL) harness porting/*.t ../lib/diagnostics.t
 
 # Handy way to run perlbug -ok without having to install and run the
 # installed perlbug. We don't re-run the tests here - we trust the user.
@@ -1448,30 +1493,30 @@ test-reonly: test_prep
 .PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
 
 ok:    utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
+       $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
 
 okfile:        utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
+       $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
 
 oknack:        utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
+       $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
 
 okfilenack:    utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
+       $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
 
 nok:   utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
+       $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
 
 nokfile:       utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
+       $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
 
 noknack:       utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
+       $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
 
 nokfilenack:   utilities
-       $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
+       $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
 
-.PHONY: clist hlist shlist pllist
+.PHONY: clist hlist shlist
 
 clist: $(c)
        echo $(c) | tr ' ' $(TRNL) >.clist
@@ -1482,9 +1527,6 @@ hlist:  $(h)
 shlist: $(sh)
        echo $(sh) | tr ' ' $(TRNL) >.shlist
 
-pllist: $(pl)
-       echo $(pl) | tr ' ' $(TRNL) >.pllist
-
 Makefile: Makefile.SH ./config.sh
        $(SHELL) Makefile.SH
 
@@ -1492,24 +1534,7 @@ Makefile: Makefile.SH ./config.sh
 distcheck: FORCE
        perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
 
-.PHONY: elc
-elc:   emacs/cperl-mode.elc
-
-emacs/cperl-mode.elc: emacs/cperl-mode.el
-       -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
-
-.PHONY: etags ctags tags
-
-etags: TAGS
-
-TAGS: emacs/cperl-mode.elc
-       sh emacs/ptags
-
-# Let's hope make will not go into an infinite loop on case-unsensitive systems
-# This may also fail if . is in the head of the path, since perl will
-# require -Ilib
-tags:  TAGS
-       perl emacs/e2ctags.pl TAGS > tags
+.PHONY: ctags
 
 ctags:
        ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c --exclude=perlmini.c *.c *.h