This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Replace utils/Makefile.SH with utils/Makefile.PL
[perl5.git] / Makefile.SH
index 2b50033..ccc857c 100755 (executable)
@@ -1,3 +1,14 @@
+#!/bin/sh
+
+# quote() - Creates a shell literal
+# Usage:  echo "...` quote "..." `..."
+quote() {
+       case "$1" in
+       '') echo "''" ;;
+       *)  echo "$1" | sed 's/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g' ;;
+       esac
+}
+
 case $PERL_CONFIG_SH in
 '')
        if test -f config.sh
@@ -26,6 +37,7 @@ case "$0" in
 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
 esac
 
+pwd="`pwd`"
 linklibperl='$(LIBPERL)'
 linklibperl_nonshr=''
 shrpldflags='$(LDDLFLAGS)'
@@ -37,10 +49,8 @@ true)
        # Prefix all runs of 'miniperl' and 'perl' with
        # $ldlibpth so that ./perl finds *this* shared libperl.
        case "$LD_LIBRARY_PATH" in
-       '')
-               ldlibpth="LD_LIBRARY_PATH=`pwd`";;
-       *)
-               ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
+       '')  ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `" ;;
+       *)   ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `:` quote "$LD_LIBRARY_PATH" `" ;;
        esac
 
        pldlflags="$cccdlflags"
@@ -52,7 +62,7 @@ true)
                -compatibility_version 1 -current_version $patchlevel \
                -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
                ;;
-       rhapsody*|darwin*)
+       darwin*)
                shrpldflags="${ldflags} -dynamiclib \
                             -compatibility_version \
                                ${api_revision}.${api_version}.${api_subversion} \
@@ -119,19 +129,19 @@ true)
                ldlibpth=''
                ;;
            *)
-               eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\""
+               eval "ldlibpthval=\"\$$ldlibpthname\""
+
+               case "$ldlibpthval" in
+               '')  ldlibpth="$ldlibpthname=` quote "$pwd" `" ;;
+               *)   ldlibpth="$ldlibpthname=` quote "$pwd" `:` quote "$ldlibpthval" `" ;;
+               esac
+
                ;;
            esac
-           # Strip off any trailing :'s
-           ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
+
            ;;
         esac
 
-       case "$ldlibpth" in
-       # Protect any spaces
-       *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
-       esac
-
        case "$osname" in
        linux)
            # If there is a pre-existing $libperl from a previous
@@ -178,7 +188,7 @@ done
 dynamic_list=' '
 dynamic_ext_re="lib/auto/re/re.$dlext"
 extra_dep='
-ext/Pod-Functions/pm_to_blib: cpan/Pod-Simple/pm_to_blib pod/perlfunc.pod
+ext/Pod-Functions/pm_to_blib: cpan/Pod-Simple/pm_to_blib cpan/Pod-Escapes/pm_to_blib pod/perlfunc.pod
 '
 for f in $dynamic_ext; do
     : the dependency named here will never exist
@@ -296,7 +306,7 @@ RUN = $run
 
 # These variables may need to be manually set for non-Unix systems.
 AR = $full_ar
-HOST_EXE_EXT = 
+HOST_EXE_EXT = $_exe
 EXE_EXT = $_exe
 LIB_EXT = $_a
 OBJ_EXT = $_o
@@ -433,16 +443,27 @@ xconfig.h: config_h.SH Cross/config-\$(CROSS_NAME).sh
        ;;
 esac
 
+SH_to_target() {
+    echo $@ | sed -e s/\\\.SH//g -e s/_/./g
+}
+
+SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH x2p/Makefile.SH'
+shextract=`SH_to_target $SH`
+
 ## In the following dollars and backticks do not need the extra backslash.
-$spitshell >>$Makefile <<'!NO!SUBS!'
+$spitshell >>$Makefile <<!GROK!THIS!
 
-private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h lib/buildcustomize.pl
+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 makedepend.SH myconfig.SH pod/Makefile.SH
+sh = $SH
+
+shextract = $shextract
+!GROK!THIS!
 
-shextract = Makefile cflags config.h makedepend makedir myconfig pod/Makefile
+## In the following dollars and backticks do not need the extra backslash.
+$spitshell >>$Makefile <<'!NO!SUBS!'
 
 addedbyconf = UU $(shextract) pstruct
 
@@ -456,7 +477,7 @@ unidatafiles = lib/unicore/Decomposition.pl lib/unicore/TestProp.pl \
 unidatadirs = lib/unicore/To lib/unicore/lib
 
 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
+h2 = embed.h form.h gv.h handy.h hv.h hv_func.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 op_reg_common.h l1_char_class_tab.h
@@ -482,12 +503,10 @@ mini_obj = $(minindt_obj) $(MINIDTRACE_O)
 ndt_obj = $(obj0) $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
 obj = $(ndt_obj) $(DTRACE_O)
 
-perltoc_pod_prereqs = extra.pods pod/perl5160delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
+perltoc_pod_prereqs = extra.pods pod/perl5192delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
 generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs)
 generated_headers = uudmap.h bitcount.h mg_data.h
 
-Icwd = -Idist/Cwd -Idist/Cwd/lib -Idist/Carp/lib
-
 lintflags = \
     -b \
     -n \
@@ -579,18 +598,21 @@ perl$(OBJ_EXT): git_version.h
 case "$usedl$static_cwd" in
 defineundef)
     util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE'
-     x2p_deps='$(MINIPERL_EXE) $(CONFIGPM) $(dynamic_ext) FORCE'
+     x2p_deps="\$(MINIPERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE"
     ;;
 definedefine)
     util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
-     x2p_deps='$(PERL_EXE) $(CONFIGPM) $(dynamic_ext) FORCE'
+     x2p_deps="\$(PERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE"
     ;;
 *)  util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
-     x2p_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
+     x2p_deps="\$(PERL_EXE) \$(CONFIGPM) x2p/$firstmakefile FORCE"
     ;;
 esac
 
 $spitshell >>$Makefile <<!GROK!THIS!
+x2p/$firstmakefile:    makedepend
+       cd x2p; \$(MAKE) depend
+
 translators:   $x2p_deps
        @echo " "; echo "       Making x2p stuff"; cd x2p; \$(LDLIBPTH) \$(MAKE) all
 
@@ -600,7 +622,10 @@ x2p/s2p: $x2p_deps
 x2p/find2perl: $x2p_deps
        cd x2p; \$(LDLIBPTH) \$(MAKE) find2perl
 
-utilities:     $util_deps
+utils/Makefile: \$(MINIPERL_EXE) \$(CONFIGPM) utils/Makefile.PL
+       \$(MINIPERL) -Ilib utils/Makefile.PL
+
+utilities:     utils/Makefile $util_deps
        @echo " "; echo "       Making utilities"; cd utils; \$(LDLIBPTH) \$(MAKE) all
 
 !GROK!THIS!
@@ -659,15 +684,9 @@ generate_uudmap$(OBJ_EXT): mg_raw.h
 generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
        $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
 
-miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
-       $(CCCMD) $(PLDLFLAGS) $*.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
-
 # The file ext.libs is a list of libraries that must be linked in
 # for static extensions, e.g. -lm -lgdbm, etc.  The individual
 # static extension Makefile's add to it.
@@ -827,21 +846,32 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT)
 # build problems but that's not obvious to the novice.
 # The Module used here must not depend on Config or any extensions.
 
+# The seemingly cranky ordering of having $(MINIPERL_EXE) depend on
+# lib/buildcustomize.pl despite the reality that lib/buildcustomize.pl needs
+# miniperl to exist first permits us to
+# a) have one rule generate both miniperl and lib/buildcustomize.pl
+#    (so that lib/buildcustomise.pl is always available. This simplifies things)
+# b) have the rest of the Makefile depend on the more obvious $(MINIPERL_EXE)
+
+$(MINIPERL_EXE): lib/buildcustomize.pl
+
 !NO!SUBS!
 
        case "${osname}${osvers}" in
-       aix*|beos*)
+       aix*)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-$(MINIPERL_EXE): $& $(mini_obj)
+lib/buildcustomize.pl: $& $(mini_obj)
        $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(mini_obj) $(libs)
-       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+       $(MINIPERL) -f write_buildcustomize.pl
 !NO!SUBS!
                ;;
        next4*)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-$(MINIPERL_EXE): $& $(mini_obj)
-       $(CC) -o $(MINIPERL_EXE) $(mini_obj) $(libs)
-       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+lib/buildcustomize.pl: $& $(mini_obj) write    ldcustomize.pl
+       $(CC) -o $(MINIPERL_EXE) $(mini_obj    libs)
+       $(LDLIBPTH) $(RUN) ./miniperl$(HOST    _EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+       $(MINIPERL) -f write_buildcustomize.pl    
 !NO!SUBS!
                ;;
        darwin*)
@@ -858,40 +888,31 @@ NAMESPACEFLAGS = -force_flat_namespace
                    ;;
                esac
                $spitshell >>$Makefile <<'!NO!SUBS!'
-$(MINIPERL_EXE): $& $(mini_obj)
+lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl
        -@rm -f miniperl.xok
        $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
            $(mini_obj) $(libs)
-       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+       $(MINIPERL) -f write_buildcustomize.pl
 !NO!SUBS!
                ;;
        *)
                $spitshell >>$Makefile <<'!NO!SUBS!'
-$(MINIPERL_EXE): $& $(mini_obj)
+lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl
        -@rm -f miniperl.xok
        $(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
            $(mini_obj) $(libs)
-       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
+       $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
+       $(MINIPERL) -f write_buildcustomize.pl
 !NO!SUBS!
                ;;
        esac
 
        $spitshell >>$Makefile <<'!NO!SUBS!'
 
-$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
+$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
        -@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.
-
-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)
-
-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)
-
-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)
+       $(SHRPENV) $(LDLIBPTH) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 !NO!SUBS!
 
@@ -901,8 +922,6 @@ linux*|darwin*)
 # Valgrind perl (currently Linux, Darwin only)
 
 perl.valgrind.config: config.sh
-       @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..."
-       @$(MAKE) perl.config.dashg
        @echo "Checking usemymalloc='n' in config.sh..."
        @grep "^usemymalloc="    config.sh
        @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
@@ -914,77 +933,6 @@ esac
 
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
-# Third Degree Perl (Tru64 only)
-
-perl.config.dashg:
-       @echo "Checking optimize='-g' in config.sh..."
-       @grep "^optimize=" config.sh
-       @egrep "^optimize='(.*-g.*)'" config.sh >/dev/null || exit 1
-
-perl.third.config: config.sh
-       @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
-       @$(MAKE) perl.config.dashg
-       @echo "Checking usemymalloc='n' in config.sh..."
-       @grep "^usemymalloc="    config.sh
-       @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
-
-perl.third: /usr/bin/atom perl.third.config perl
-       atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl
-       @echo "Now you may run perl.third and then study perl.3log."
-
-# Pixie Perls (Tru64 and IRIX only)
-
-perl.pixie.config: config.sh
-       @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
-       @$(MAKE) perl.config.dashg
-
-perl.pixie.atom: /usr/bin/atom perl
-       atom -tool pixie -L. -all -toolargs="-quiet" perl
-
-perl.pixie.irix: perl
-       pixie perl
-
-perl.pixie: /usr/bin/pixie perl.pixie.config perl
-       if test -x /usr/bin/atom; then \
-         $(MAKE) perl.pixie.atom; \
-       else \
-         $(MAKE) perl.pixie.irix; \
-       fi
-       @echo "Now you may run perl.pixie and then run pixie."
-
-# Gprof Perl
-
-perl.config.dashpg:
-       @echo "Checking optimize='-pg' in config.sh..."
-       @grep "^optimize="      config.sh
-       @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
-
-perl.gprof.config: config.sh
-       @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
-       @$(MAKE) perl.config.dashpg
-
-perl.gprof: /usr/bin/gprof perl.gprof.config
-       @-rm -f perl
-       $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
-       @echo "Now you may run perl.gprof and then run gprof perl.gprof."
-
-# Gcov Perl
-
-perl.config.gcov:
-       @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
-       @echo "Checking gccversion in config.sh..."
-       @grep "^gccversion="      config.sh
-       @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
-       @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
-       @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
-       @grep "^ccflags="      config.sh
-       @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
-
-perl.gcov: perl.config.gcov
-       @-rm -f perl
-       $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
-       @echo "Now you may run perl.gcov and then run gcov some.c."
-
 # Microperl.  This is just a convenience thing if one happens to
 # build also the full Perl and therefore the real big Makefile:
 # usually one should manually explicitly issue the below command.
@@ -1014,7 +962,7 @@ makeppport: \$(MINIPERL_EXE) \$(CONFIGPM)
 $spitshell >>$Makefile <<'!NO!SUBS!'
 .PHONY: makeppport
 makeppport: $(MINIPERL_EXE) $(CONFIGPM) $(nonxs_ext)
-       $(MINIPERL) $(Icwd) mkppport
+       $(MINIPERL) mkppport
 
 !NO!SUBS!
 ;;
@@ -1033,18 +981,15 @@ $(CONFIGPOD): config.sh $(MINIPERL_EXE) configpm Porting/Glossary lib/Config_git
 lib/ExtUtils/Miniperl.pm: miniperlmain.c $(MINIPERL_EXE) minimod.pl $(CONFIGPM)
        $(MINIPERL) minimod.pl > lib/ExtUtils/Miniperl.pm
 
-lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl
-       $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl
-
 unidatafiles $(unidatafiles) pod/perluniprops.pod: 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
+       $(MINIPERL) 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
 
-# $(PERL_EXE) and ext because buildtoc uses Text::Wrap uses re
+# $(PERL_EXE) and ext because pod_lib.pl needs Digest::MD5
 # 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) pod/buildtoc
@@ -1056,10 +1001,11 @@ pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc
        $(MINIPERL) autodoc.pl
 
 pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
-       $(MINIPERL) $(Icwd) pod/perlmodlib.PL -q
+       $(MINIPERL) pod/perlmodlib.PL -q
 
-pod/perl5160delta.pod: pod/perldelta.pod
-       $(LNS) perldelta.pod pod/perl5160delta.pod
+pod/perl5192delta.pod: pod/perldelta.pod
+       $(RMS) pod/perl5192delta.pod
+       $(LNS) perldelta.pod pod/perl5192delta.pod
 
 extra.pods: $(MINIPERL_EXE)
        -@test ! -f extra.pods || rm -f `cat extra.pods`
@@ -1177,10 +1123,13 @@ regen_headers regen-headers:    FORCE
        -perl regen.pl -v
        -perl regen/uconfig_h.pl -v
 
-regen_meta regen-meta:  META.yml
+regen_meta regen-meta:  META.yml META.json
 
 META.yml:   FORCE
-       PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta
+       PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta -y
+
+META.json:   FORCE
+       PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta -j
 
 
 regen_all regen-all: regen regen_meta
@@ -1207,7 +1156,7 @@ manicheck:        FORCE
 $(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) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT)
+d_dummy $(dynamic_ext):        $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) $(LIBPERL)
        $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
 
 s_dummy $(static_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
@@ -1257,13 +1206,10 @@ _mopup:
        -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
        -rm -f perl.exp ext.libs $(generated_pods) uni.data opmini.o perlmini.o pod/roffitall
        -rm -f perl.export perl.dll perl.libexp perl.map perl.def
-       -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
-       -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
-       -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 *perl.xok
        -rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
        -rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
-       -rm -f config.arch config.over $(DTRACE_H) runtests
+       -rm -f config.arch config.over $(DTRACE_H)
 
 # Do not 'make _tidy' directly.
 _tidy:
@@ -1288,7 +1234,7 @@ _cleaner1:
        sh $(CLEAN).sh ; \
        fi
        rm -f realclean.sh veryclean.sh
-       -for file in `find cpan dist ext -name ppport.h` ; do rm -f $$file; done
+       -rm -f `grep -v ^# mkppport.lst | grep . | sed -e 's/$$/\/ppport.h/'`
 
 # Dear POSIX, thanks for making the default to xargs to be
 # run once if nothhing is passed in. It is such a great help.
@@ -1317,11 +1263,10 @@ _cleaner2:
        rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT)
        rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX)
        rm -fr lib/B
-       rm -fr lib/CPAN lib/CPANPLUS
+       rm -fr lib/CPAN
        rm -fr lib/ExtUtils/CBuilder
        rm -f pod2htmd.tmp
        rm -rf pod/perlfunc pod/perlipc
-       -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 lib/Carp
@@ -1376,33 +1321,30 @@ MAKEDEPEND = Makefile makedepend
 
 $(FIRSTMAKEFILE):      README $(MAKEDEPEND)
        $(MAKE) depend MAKEDEPEND=
+!NO!SUBS!
 
-config.h: config_h.SH config.sh
-       $(SHELL) config_h.SH
+for f in $SH; do
+    file=`SH_to_target $f`
+    $spitshell >>$Makefile <<!GROK!THIS!
 
-.PHONY: depend
-depend: makedepend
-       sh ./makedepend MAKE=$(MAKE)
-       cd x2p; $(MAKE) depend
+$file: $f config.sh
+       \$(SHELL) $f
+!GROK!THIS!
+done
 
-# Cannot postpone this until $firstmakefile is ready ;-)
-makedepend: makedepend.SH config.sh
-       sh ./makedepend.SH
+$spitshell >>$Makefile <<'!NO!SUBS!'
 
-runtests: runtests.SH config.sh
-       sh ./runtests.SH
+.PHONY: depend
+depend: makedepend
+       sh ./makedepend MAKE=$(MAKE) cflags
 
 .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 _test
+       test_harness test_harness_notty minitest test-reonly _test
 
 _test:
        echo >&2 The _test target is deprecated. Please upgrade your smoker
-       PERL=./perl $(RUN_TESTS) choose
+       $(RUN_TESTS) choose
 
 # Cannot delegate rebuilding of t/perl to make
 # to allow interlaced test and minitest
@@ -1429,29 +1371,6 @@ test_tty test-tty: test_prep
 test_notty test-notty: test_prep
        $(RUN_TESTS) no-tty
 
-utest ucheck test.utf8 check.utf8: test_prep
-       TEST_ARGS=-utf8 $(RUN_TESTS) choose
-
-coretest: test_prep
-       TEST_ARGS=-core $(RUN_TESTS) choose
-
-# Torture testing
-
-test.torture torturetest:      test_prep
-       TEST_ARGS=-torture $(RUN_TESTS) choose
-
-# Targets for UTF16 testing:
-
-minitest.utf16: minitest.prep
-       - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \
-               && $(RUN_PERL) TEST -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
-
-test.utf16 check.utf16: test_prep
-       TEST_ARGS=-utf16 $(RUN_TESTS) choose
-
-utest.utf16 ucheck.utf16: test_prep
-       TEST_ARGS="-utf8 -utf16" $(RUN_TESTS) choose
-
 !NO!SUBS!
 
 case "${osname}${osvers}" in
@@ -1464,9 +1383,6 @@ test_prep.valgrind: test_prep perl.valgrind
 test.valgrind check.valgrind:  test_prep perl.valgrind.config
        PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(RUN_TESTS) choose
 
-utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config
-       PERL_VALGRIND=1 TEST_ARGS=-utf8 $(RUN_TESTS) choose
-
 test_notty.valgrind: test_prep.valgrind perl.valgrind.config
        PERL_VALGRIND=1 $(RUN_TESTS) no-tty
 !NO!SUBS!
@@ -1475,45 +1391,16 @@ esac
 
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
-# Targets for Third Degree testing.
-
-test_prep.third: test_prep perl.third
-       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_3LOG=1 $(RUN_TESTS) choose
-
-utest.third ucheck.third: test_prep.third perl.third
-       PERL=./perl.third PERL_3LOG=1 TEST_ARGS=-utf8 $(RUN_TESTS) choose
-
-test_notty.third: test_prep.third perl.third
-       PERL=./perl.third PERL_3LOG=1 $(RUN_TESTS) choose
-
-# Targets for Deparse testing.
-
-test.deparse:  test_prep
-       TEST_ARGS=-deparse $(RUN_TESTS) choose
-
-test_notty.deparse:    test_prep
-       TEST_ARGS=-deparse $(RUN_TESTS) no-tty
-
-# Targets to run the test suite with -t
-
-test.taintwarn:        test_prep
-       TEST_ARGS=-taintwarn $(RUN_TESTS) choose
-
-minitest.prep:
+# Can't depend on lib/Config.pm because that might be where miniperl
+# is crashing.
+minitest: $(MINIPERL_EXE)
        -@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, or the Unicode data files."
        @echo " "
-
-# Can't depend on lib/Config.pm because that might be where miniperl
-# is crashing.
-minitest: $(MINIPERL_EXE) minitest.prep
        - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \
-               && $(RUN_PERL) TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t op/*.t uni/*.t </dev/tty
+               && $(RUN_PERL) TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t </dev/tty
 
 # Test via harness
 
@@ -1563,7 +1450,7 @@ noknack:  utilities
 nokfilenack:   utilities
        $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
 
-.PHONY: clist hlist shlist
+.PHONY: clist hlist
 
 clist: $(c)
        echo $(c) | tr ' ' $(TRNL) >.clist
@@ -1571,12 +1458,6 @@ clist:   $(c)
 hlist:  $(h)
        echo $(h) | tr ' ' $(TRNL) >.hlist
 
-shlist: $(sh)
-       echo $(sh) | tr ' ' $(TRNL) >.shlist
-
-Makefile: Makefile.SH ./config.sh
-       $(SHELL) Makefile.SH
-
 .PHONY: distcheck
 distcheck: FORCE
        perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
@@ -1591,12 +1472,6 @@ ctags:
 !NO!SUBS!
 
 $eunicefix Makefile
-case `pwd` in
-*SH)
-    $rm -f ../Makefile
-    $ln Makefile ../Makefile
-    ;;
-esac
 $rm -f $firstmakefile
 
 # Now do any special processing required before building.
@@ -1646,9 +1521,6 @@ os390|posix-bc)
         cd ..
     fi
     ;;
-vmesa)
-    # Do nothing in VM/ESA.
-    ;;
 *)
     echo "'$osname' is an EBCDIC system I don't know that well." >&4
     ;;