This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / Makefile.SH
index c7a1570..1b39468 100755 (executable)
@@ -56,22 +56,24 @@ true)
        pldlflags="$cccdlflags"
        static_ldflags=''
        case "${osname}${osvers}" in
-       next4*)
-               ld=libtool
-               lddlflags="-dynamic -undefined warning -framework System \
-               -compatibility_version 1 -current_version $patchlevel \
-               -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
-               ;;
        darwin*)
                shrpldflags="${ldflags} -dynamiclib \
                             -compatibility_version \
                                ${api_revision}.${api_version}.${api_subversion} \
                             -current_version \
-                               ${revision}.${patchlevel}.${subversion} \
-                            -install_name \$(shrpdir)/\$@"
+                               ${revision}.${patchlevel}.${subversion}"
+               case "$osvers" in
+               1[5-9]*|[2-9]*)
+                       shrpldflags="$shrpldflags -install_name `pwd`/\$@ -Xlinker -headerpad_max_install_names"
+                       exeldflags="-Xlinker -headerpad_max_install_names"
+                       ;;
+               *)
+                       shrpldflags="$shrpldflags -install_name \$(shrpdir)/\$@"
+                       ;;
+               esac
                ;;
        cygwin*)
-               shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a -Wl,--image-base,0x52000000"
+               shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a"
                linklibperl="-L. -lperl"
                ;;
        sunos*)
@@ -116,10 +118,15 @@ true)
                linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
                ;;
        os390*)
-            shrpldflags='-W l,XPLINK,dll'
-           linklibperl='libperl.x'
-           DPERL_EXTERNAL_GLOB=''
-           ;;
+            case "$use64bitall" in
+            define|true|[yY]*) shrpldflags='-Wl,LP64,dll'
+                   linklibperl='libperl.x'
+                   ;;
+            *)     shrpldflags='-Wl,XPLINK,dll'
+                  linklibperl='libperl.x'
+                  ;;
+            esac
+            ;;
        esac
        case "$ldlibpthname" in
        '') ;;
@@ -174,20 +181,32 @@ EOT
        ;;
 esac
 
+# ccdlflags, not to be confused with cccdlflags:
+case "${osname}" in
+aix)
+       # In AIX we need to change this for building Perl itself from
+       # the config.sh definition (which is for building external
+       # extensions *after* Perl has been built and installed)
+       ccdlflags=`echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
+       ;;
+esac
+
 : is Cwd static or dynamic
 static_cwd='define'
 list_util_dep='$(PERL_EXE)'
 for f in $dynamic_ext; do
    case $f in
        Cwd) static_cwd='undef' ;;
-       List/Util) list_util_dep=lib/auto/List/Util/Util.$dlext
+       List/Util) list_util_dep=lib/auto/List/Util/Util.$dlext ;;
    esac
 done
 
-: Prepare dependency lists for Makefile.
+: Prepare dependency lists for Makefile.  Non-Unix systems likely will also
+: require changes in make_ext.pl
 dynamic_list=' '
 dynamic_ext_re="lib/auto/re/re.$dlext"
 extra_dep='
+cpan/Pod-Simple/pm_to_blib: dist/if/pm_to_blib
 ext/Pod-Functions/pm_to_blib: cpan/Pod-Simple/pm_to_blib cpan/Pod-Escapes/pm_to_blib pod/perlfunc.pod
 cpan/IO-Compress/pm_to_blib: dist/lib/pm_to_blib
 '
@@ -271,6 +290,7 @@ LNS = $lns
 CPS = $cp
 RMS = rm -f
 ranlib = $ranlib
+ECHO = $echo
 
 # The following are mentioned only to make metaconfig include the
 # appropriate questions in Configure.  If you want to change these,
@@ -294,7 +314,6 @@ DLSUFFIX = .$dlext
 PLDLFLAGS = $pldlflags
 LIBPERL = $libperl
 LLIBPERL= $linklibperl
-LLIBPERL_NONSHR= $linklibperl_nonshr
 SHRPENV = $shrpenv
 
 # Static targets are ordinarily built without CCCDLFLAGS.  However,
@@ -322,7 +341,6 @@ HOST_EXE_EXT = $_exe
 EXE_EXT = $_exe
 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)
@@ -334,6 +352,14 @@ MANIFEST_SRT = MANIFEST.srt
 
 !GROK!THIS!
 
+case "$useshrplib$osname" in
+truedarwin)
+       $spitshell >>$Makefile <<!GROK!THIS!
+PERL_EXE_LDFLAGS=$exeldflags
+!GROK!THIS!
+       ;;
+esac
+
 case "$usecrosscompile$perl" in
 define?*)
        $spitshell >>$Makefile <<!GROK!THIS!
@@ -409,7 +435,7 @@ FIRSTMAKEFILE = $firstmakefile
 # Any special object files needed by this architecture, e.g. os2/os2.obj
 ARCHOBJS = $archobjs
 
-.SUFFIXES: .c \$(OBJ_EXT) .i .s
+.SUFFIXES: .c \$(OBJ_EXT) .i .s .c.depends
 
 # grrr
 SHELL = $sh
@@ -479,6 +505,15 @@ sh = $SH
 shextract = $shextract
 !GROK!THIS!
 
+# Source files where we build a variant for miniperl:
+mini_special='op perl universal'
+for file in $mini_special; do
+    mini_special_c="$mini_special_c ${file}mini.c"
+    mini_only_objs="$mini_only_objs ${file}mini\$(OBJ_EXT)"
+    main_only_objs="$main_only_objs ${file}\$(OBJ_EXT)"
+    ctags_exclude="$ctags_exclude --exclude=${file}mini.c"
+done
+
 ## In the following dollars and backticks do not need the extra backslash.
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
@@ -493,33 +528,55 @@ unidatafiles = lib/unicore/Decomposition.pl lib/unicore/TestProp.pl \
 # Directories of Unicode data files generated by mktables
 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 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
-h6 = charclass_invlists.h
-h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6)
+h = \
+    EXTERN.h INTERN.h XSUB.h \
+    av.h charclass_invlists.h cop.h cv.h dosish.h embed.h form.h gv.h \
+    handy.h hv.h hv_func.h iperlsys.h keywords.h l1_char_class_tab.h \
+    mg.h mydtrace.h op.h op_reg_common.h opcode.h pad.h patchlevel.h \
+    perl.h perlapi.h perly.h pp.h proto.h regcomp.h regcomp_internal.h \
+    regexp.h scope.h sv.h thread.h unixish.h utf8.h util.h warnings.h \
+    $(CONFIGH)
+
+c_base = \
+    av.c builtin.c caretx.c class.c deb.c doio.c doop.c dquote.c dump.c \
+    globals.c gv.c hv.c keywords.c locale.c mathoms.c mg.c mro_core.c \
+    numeric.c op.c pad.c peep.c perl.c perlio.c perly.c \
+    pp.c pp_ctl.c pp_hot.c pp_pack.c pp_sort.c pp_sys.c \
+    reentr.c regcomp.c regcomp_debug.c regcomp_invlist.c regcomp_study.c \
+    regcomp_trie.c regexec.c run.c scope.c sv.c taint.c time64.c toke.c \
+    universal.c utf8.c util.c \
+    $(mallocsrc)
+
+!NO!SUBS!
 
-c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro_core.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 keywords.c
-c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c dquote.c time64.c
-c5 = $(mallocsrc)
+$spitshell >>$Makefile <<!GROK!THIS!
+mini_only_src  =$mini_special_c
+mini_only_objs =$mini_only_objs
+main_only_objs =$main_only_objs
+!GROK!THIS!
 
-c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c opmini.c perlmini.c
+$spitshell >>$Makefile <<'!NO!SUBS!'
 
-obj1 = $(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_core$(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) caretx$(OBJ_EXT) dquote$(OBJ_EXT) time64$(OBJ_EXT)
+c = $(c_base) miniperlmain.c $(mini_only_src)
 
 # split the objects into 3 exclusive sets: those used by both miniperl and
 # perl, and those used by just one or the other. Doesn't include the
 # actual perl(mini)main.o, nor any dtrace objects.
 
-common_objs    = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
-mini_only_objs = opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
-main_only_objs = op$(OBJ_EXT)     perl$(OBJ_EXT)
+common_objs = \
+    av$(OBJ_EXT) builtin$(OBJ_EXT) caretx$(OBJ_EXT) class$(OBJ_EXT) \
+    deb$(OBJ_EXT) doio$(OBJ_EXT) doop$(OBJ_EXT) dquote$(OBJ_EXT) \
+    dump$(OBJ_EXT) globals$(OBJ_EXT) gv$(OBJ_EXT) hv$(OBJ_EXT) \
+    keywords$(OBJ_EXT) locale$(OBJ_EXT) mathoms$(OBJ_EXT) mg$(OBJ_EXT) \
+    mro_core$(OBJ_EXT) numeric$(OBJ_EXT) pad$(OBJ_EXT) peep$(OBJ_EXT) \
+    perlio$(OBJ_EXT) perly$(OBJ_EXT) pp$(OBJ_EXT) pp_ctl$(OBJ_EXT) \
+    pp_hot$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT) pp_sys$(OBJ_EXT) \
+    reentr$(OBJ_EXT) regcomp$(OBJ_EXT) regcomp_debug$(OBJ_EXT) \
+    regcomp_invlist$(OBJ_EXT) regcomp_study$(OBJ_EXT) regcomp_trie$(OBJ_EXT) \
+    regexec$(OBJ_EXT) run$(OBJ_EXT) scope$(OBJ_EXT) sv$(OBJ_EXT) \
+    taint$(OBJ_EXT) time64$(OBJ_EXT) toke$(OBJ_EXT) utf8$(OBJ_EXT) \
+    util$(OBJ_EXT) \
+    $(mallocobj) $(ARCHOBJS)
 
 miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
 perllib_objs_nodt  = $(main_only_objs) $(common_objs)
@@ -570,7 +627,7 @@ esac
 
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
-perltoc_pod_prereqs = extra.pods pod/perl5275delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
+perltoc_pod_prereqs = extra.pods pod/perl5398delta.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
 
@@ -610,15 +667,15 @@ lintflags = \
        @echo `$(CCCMD)` $(PLDLFLAGS) $*.c
        @`$(CCCMD)` $(PLDLFLAGS) $*.c
 
-.c.i:  perl.h config.h
+.c.i:
        @echo `$(CCCMDSRC)` -E $*.c \> $*.i
        @`$(CCCMDSRC)` -E $*.c > $*.i
 
-.c.s:  perl.h config.h
+.c.s:
        @echo `$(CCCMDSRC)` -S $*.c
        @`$(CCCMDSRC)` -S $*.c
 
-all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT)
+all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT) common_build
        @echo " ";
        @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
 
@@ -676,7 +733,7 @@ FORCE:
        @sh -c true
 !NO!SUBS!
 
-for file in op perl; do
+for file in $mini_special; do
     if $issymlink $file.c; then
         $spitshell >>$Makefile <<!GROK!THIS!
 
@@ -707,6 +764,9 @@ done
 
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
+cygwin.c: cygwin/cygwin.c
+       $(LNS) cygwin/cygwin.c
+
 globals$(OBJ_EXT): $(generated_headers)
 
 uudmap.h mg_data.h: bitcount.h
@@ -788,31 +848,10 @@ esac
 
 case "$osname" in
 aix)
-       $spitshell >>$Makefile <<!GROK!THIS!
-LIBS                   = $perllibs
-# In AIX we need to change this for building Perl itself from
-# its earlier definition (which is for building external
-# extensions *after* Perl has been built and installed)
-CCDLFLAGS              = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
-
-!GROK!THIS!
        case "$useshrplib" in
        define|true|[yY]*)
                $spitshell >>$Makefile <<'!NO!SUBS!'
 
-LIBPERL_NONSHR         = libperl_nonshr$(LIB_EXT)
-MINIPERL_NONSHR                = miniperl_nonshr$(EXE_EXT)
-
-$(LIBPERL_NONSHR): $(perllib_objs)
-       $(RMS) $(LIBPERL_NONSHR)
-       $(AR) rc $(LIBPERL_NONSHR) $(perllib_objs)
-
-$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)  perlmini$(OBJ_EXT)
-       $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
-           opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
-
-MINIPERLEXP            = $(MINIPERL_NONSHR)
-
 LIBPERLEXPORT          = perl.exp
 
 !NO!SUBS!
@@ -820,7 +859,6 @@ LIBPERLEXPORT               = perl.exp
                ;;
        *)      
                $spitshell >>$Makefile <<'!NO!SUBS!'
-MINIPERLEXP            = $(MINIPERL_EXE)
 
 PERLEXPORT             = perl.exp
 
@@ -828,7 +866,7 @@ PERLEXPORT          = perl.exp
        ;;
        esac
        $spitshell >>$Makefile <<'!NO!SUBS!'
-perl.exp: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH)
+perl.exp: $(MINIPERL_EXE) makedef.pl $(CONFIGPM) $(SYM) $(SYMH)
        $(MINIPERL) makedef.pl --sort-fold PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" > perl.exp
 
 !NO!SUBS!
@@ -842,19 +880,6 @@ perl5.def: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH) miniperl.map
 
 !NO!SUBS!
        ;;
-cygwin)
-       $spitshell >>$Makefile <<'!NO!SUBS!'
-cygwin.c: cygwin/cygwin.c
-       $(LNS) cygwin/cygwin.c
-
-LIBPERL_NONSHR         = libperl$(LIB_EXT)
-
-$(LIBPERL_NONSHR): $(perllib_objs)
-       $(RMS) $(LIBPERL_NONSHR)
-       $(AR) rc $(LIBPERL_NONSHR) $(perllib_objs)
-
-!NO!SUBS!
-       ;;
 esac
 
 if test -s $Makefile_s ; then
@@ -953,6 +978,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLEXPORT)
 # b) have the rest of the Makefile depend on the more obvious $(MINIPERL_EXE)
 
 $(MINIPERL_EXE): lib/buildcustomize.pl
+       @touch $(MINIPERL_EXE)
 
 !NO!SUBS!
 
@@ -967,22 +993,6 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
        $(MINIPERL) -f write_buildcustomize.pl
 !NO!SUBS!
                ;;
-       aix*)
-               $spitshell >>$Makefile <<'!NO!SUBS!'
-lib/buildcustomize.pl: $& $(miniperl_objs)
-       $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(miniperl_objs) $(libs)
-       $(LDLIBPTH) ./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!'
-lib/buildcustomize.pl: $& $(miniperl_objs) write    ldcustomize.pl
-       $(CC) -o $(MINIPERL_EXE) $(miniperl_objs    libs)
-       $(LDLIBPTH) ./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*)
                case "$osvers" in
                [1-6].*) ;;
@@ -1034,7 +1044,7 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
        -@rm -f miniperl.xok
 !NO!SUBS!
 
-        case $osname in
+        case "$osname" in
        # In AmigaOS the Perl executable needs to be linked with -ldl,
        # but none of the other executables should be.
         amigaos) $spitshell >>$Makefile <<'!NO!SUBS!'
@@ -1045,6 +1055,20 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
        $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
 !NO!SUBS!
         ;;
+
+       darwin)
+           case "$useshrplib$osvers" in
+           true1[5-9]*|true[2-9]*) $spitshell >>$Makefile <<'!NO!SUBS!'
+       $(SHRPENV) $(CC) -o perl $(PERL_EXE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+!NO!SUBS!
+              ;;
+           *) $spitshell >>$Makefile <<'!NO!SUBS!'
+       $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+!NO!SUBS!
+              ;;
+           esac
+        ;;
+
         *) $spitshell >>$Makefile <<'!NO!SUBS!'
        $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 !NO!SUBS!
@@ -1053,14 +1077,6 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
 
        $spitshell >>$Makefile <<'!NO!SUBS!'
 
-# 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.
-
-.PHONY: microperl
-microperl:
-       $(MAKE) -f Makefile.micro
-
 !NO!SUBS!
 
 fi
@@ -1072,7 +1088,7 @@ catamount)
 $spitshell >>$Makefile <<!GROK!THIS!
 .PHONY: makeppport
 makeppport: \$(MINIPERL_EXE) \$(CONFIGPM)
-       -@for f in Makefile.PL PPPort_pm.PL PPPort_xs.PL ppport_h.PL; do \
+       -@for f in Makefile.PL PPPort_pm.PL RealPPPort_xs.PL ppport_h.PL; do \
        (cd ext/Devel-PPPort && `pwd`/run.sh ../../$(MINIPERL_EXE) -I../../lib \$\$f); \
        done
 
@@ -1090,7 +1106,7 @@ esac
 
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
-.PHONY: preplibrary
+.PHONY: preplibrary common_build
 preplibrary: $(MINIPERL_EXE) $(CONFIGPM) $(PREPLIBRARY_LIBPERL)
 
 $(CONFIGPM_FROM_CONFIG_SH): $(CONFIGPOD)
@@ -1101,7 +1117,7 @@ $(CONFIGPOD): config.sh $(MINIPERL_EXE) configpm Porting/Glossary lib/Config_git
 unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data
 
 uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
-       $(MINIPERL) lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
+       $(MINIPERL) lib/unicore/mktables -C lib/unicore -P pod -maketest -makenormtest -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
@@ -1109,7 +1125,7 @@ uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
 # $(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
+pod/perltoc.pod: $(perltoc_pod_prereqs) $(PERL_EXE) $(ext) pod/buildtoc
        $(RUN_PERL) -f pod/buildtoc -q
 
 pod/perlapi.pod: pod/perlintern.pod
@@ -1120,9 +1136,9 @@ pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc
 pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
        $(MINIPERL) pod/perlmodlib.PL -q
 
-pod/perl5275delta.pod: pod/perldelta.pod
-       $(RMS) pod/perl5275delta.pod
-       $(LNS) perldelta.pod pod/perl5275delta.pod
+pod/perl5398delta.pod: pod/perldelta.pod
+       $(RMS) pod/perl5398delta.pod
+       $(LNS) perldelta.pod pod/perl5398delta.pod
 
 extra.pods: $(MINIPERL_EXE)
        -@test ! -f extra.pods || rm -f `cat extra.pods`
@@ -1153,7 +1169,6 @@ no_install no-install: install-notify
 install: install-all
 !NO!SUBS!
 
-
 for name in all notify silent strip verbose; do
     flags="--$name";
     flags=`echo $flags | sed -e 's/--all//'`
@@ -1177,50 +1192,38 @@ EOT
 done
 
 if test "X$hostperl" != X; then
+       LOCAL_PERL='$(HOST_PERL)'
        $spitshell >>$Makefile <<'!NO!SUBS!'
 install.perl:  $(INSTALL_DEPENDENCE) installperl
        $(HOST_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
        -@test ! -s extras.lst || $(MAKE) extras.install
-
-install.man:   all installman
-       $(HOST_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 ..
-       $(HOST_PERL) installhtml   \
-      --podroot=. --podpath=. --recurse  \
-      --htmldir=$(privlib)/html   \
-      --htmlroot=$(privlib)/html  \
-      --splithead=pod/perlipc     \
-      --splititem=pod/perlfunc    \
-      --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
-      --verbose
 !NO!SUBS!
 else
+       LOCAL_PERL='$(RUN_PERL)'
        $spitshell >>$Makefile <<'!NO!SUBS!'
 install.perl:  $(INSTALL_DEPENDENCE) installperl
        $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
        -@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
 
+!NO!SUBS!
+fi
+
+$spitshell >>$Makefile <<!GROK!THIS!
 install.man:   all installman
-       $(RUN_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
+       ${LOCAL_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 ..
-       $(RUN_PERL) installhtml   \
-      --podroot=. --podpath=. --recurse  \
-      --htmldir=$(privlib)/html   \
-      --htmlroot=$(privlib)/html  \
-      --splithead=pod/perlipc     \
-      --splititem=pod/perlfunc    \
-      --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
+       -@test -f README.vms && cd vms && \$(LNS) ../README.vms README_vms.pod && cd ..
+       ${LOCAL_PERL} installhtml   \\
+      --podroot=. --podpath=. --recurse  \\
+      --htmldir=\$(privlib)/html   \\
+      --splithead=pod/perlipc     \\
+      --splititem=pod/perlfunc    \\
+      --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \\
       --verbose
-!NO!SUBS!
-fi
+!GROK!THIS!
 
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
@@ -1254,7 +1257,7 @@ SYMH = perlvars.h intrpvar.h
 CHMOD_W = chmod +w
 
 # The following files are generated automatically
-#      embed.pl:       proto.h embed.h embedvar.h perlapi.h perlapi.c
+#      embed.pl:       proto.h embed.h embedvar.h
 #      opcode.pl:      opcode.h opnames.h pp_proto.h
 #      regcomp.pl:     regnodes.h
 #      warnings.pl:    warnings.h lib/warnings.pm
@@ -1266,19 +1269,13 @@ CHMOD_W = chmod +w
 # with your existing copy of perl
 # (make regen_headers is kept for backwards compatibility)
 
-AUTOGEN_FILES = opcode.h opnames.h pp_proto.h proto.h embed.h embedvar.h \
-               perlapi.h perlapi.c regnodes.h warnings.h lib/warnings.pm \
-               lib/feature.pm feature.h
-
 .PHONY: regen_headers regen_all
 
 regen: FORCE
        -perl regen.pl
-       -perl regen/uconfig_h.pl
 
 regen_headers regen-headers:   FORCE
        -perl regen.pl -v
-       -perl regen/uconfig_h.pl -v
 
 regen_meta regen-meta:  META.yml META.json
 
@@ -1359,15 +1356,16 @@ veryclean:      _verycleaner _mopup _clobber
 
 # Do not 'make _mopup' directly.
 _mopup:
-       rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c perlmini.c generate_uudmap$(EXE_EXT) $(generated_headers)
+       rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c $(mini_only_src) generate_uudmap$(EXE_EXT) $(generated_headers)
        -rmdir .depending
+       -rm *.depends makedepend_file
        -@test -f extra.pods && rm -f `cat extra.pods`
        -@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.exp ext.libs $(generated_pods) uni.data $(mini_only_objs) pod/roffitall
        -rm -f perl.export perl.dll perl.libexp perl.map perl.def
        -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 $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.*
        -rm -f config.arch config.over $(DTRACE_H)
 
 _cleaner1:
@@ -1385,9 +1383,17 @@ _cleaner1:
        -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.
+# run once if nothing is passed in. It is such a great help.
 
 # Some systems do not support "?", so keep these files separate.
+
+# The Time::HiRes Makefile *should* remove dist/Time-HiRes/xdefine for 'clean',
+# but it's possible to get a rebuilt checkout into a state where it can't run
+# distclean, and can't recover until the file is gone.
+# There's no harm in adding it to the top level 'distclean' target - it should
+# anyway by then, and miniperl is long gone.
+# Add new rules before that line - the next line (rm -f so_locations ...) is
+# used as a placeholder by a regen script.
 _cleaner2:
        -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
        rm -f core *perl.core t/core t/*perl.core core.* t/core.*
@@ -1405,48 +1411,56 @@ _cleaner2:
        rm -f pod2htmd.tmp
        rm -rf pod/perlfunc pod/perlipc
        -rmdir ext/B/lib
-       rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
+       -rm -f dist/Time-HiRes/xdefine
+       rm -f so_locations $(LIBPERL_NONSHR)
        -rmdir lib/version lib/threads lib/inc/ExtUtils lib/inc lib/encoding
        -rmdir lib/autodie/exception lib/autodie/Scope lib/autodie lib/XS
        -rmdir lib/Win32API lib/VMS lib/Unicode/Collate/Locale
        -rmdir lib/Unicode/Collate/CJK lib/Unicode/Collate lib/Tie/Hash
-       -rmdir lib/Thread lib/Text lib/Test2/Util lib/Test2/Tools
-       -rmdir lib/Test2/IPC/Driver lib/Test2/IPC lib/Test2/Hub/Interceptor
-       -rmdir lib/Test2/Hub lib/Test2/Formatter lib/Test2/EventFacet
-       -rmdir lib/Test2/Event/TAP lib/Test2/Event lib/Test2/API lib/Test2
-       -rmdir lib/Test/use lib/Test/Tester lib/Test/Builder/Tester
-       -rmdir lib/Test/Builder/IO lib/Test/Builder lib/Test lib/Term
-       -rmdir lib/TAP/Parser/YAMLish lib/TAP/Parser/SourceHandler
-       -rmdir lib/TAP/Parser/Scheduler lib/TAP/Parser/Result
-       -rmdir lib/TAP/Parser/Iterator lib/TAP/Parser lib/TAP/Harness
-       -rmdir lib/TAP/Formatter/File lib/TAP/Formatter/Console
-       -rmdir lib/TAP/Formatter lib/TAP lib/Sys/Syslog lib/Sys lib/Sub
-       -rmdir lib/Search lib/Scalar lib/Pod/Text lib/Pod/Simple
-       -rmdir lib/Pod/Perldoc lib/PerlIO/via lib/PerlIO lib/Perl
-       -rmdir lib/Parse/CPAN lib/Parse lib/Params lib/Net/FTP lib/Module/Load
-       -rmdir lib/Module/CoreList lib/Module lib/Memoize lib/Math/BigInt
+       -rmdir lib/Thread lib/Text lib/Test2/Workflow/Task lib/Test2/Workflow
+       -rmdir lib/Test2/Util/Table lib/Test2/Util lib/Test2/Tools
+       -rmdir lib/Test2/Require lib/Test2/Plugin
+       -rmdir lib/Test2/Manual/Tooling/Plugin lib/Test2/Manual/Tooling
+       -rmdir lib/Test2/Manual/Testing lib/Test2/Manual/Anatomy
+       -rmdir lib/Test2/Manual lib/Test2/IPC/Driver lib/Test2/IPC
+       -rmdir lib/Test2/Hub/Interceptor lib/Test2/Hub lib/Test2/Formatter
+       -rmdir lib/Test2/EventFacet/Info lib/Test2/EventFacet
+       -rmdir lib/Test2/Event/TAP lib/Test2/Event lib/Test2/Compare
+       -rmdir lib/Test2/Bundle lib/Test2/AsyncSubtest/Event
+       -rmdir lib/Test2/AsyncSubtest lib/Test2/API/InterceptResult
+       -rmdir lib/Test2/API lib/Test2 lib/Test/use lib/Test/Tester
+       -rmdir lib/Test/Builder/Tester lib/Test/Builder/IO lib/Test/Builder
+       -rmdir lib/Test lib/Term/Table lib/Term lib/TAP/Parser/YAMLish
+       -rmdir lib/TAP/Parser/SourceHandler lib/TAP/Parser/Scheduler
+       -rmdir lib/TAP/Parser/Result lib/TAP/Parser/Iterator lib/TAP/Parser
+       -rmdir lib/TAP/Harness lib/TAP/Formatter/File
+       -rmdir lib/TAP/Formatter/Console lib/TAP/Formatter lib/TAP
+       -rmdir lib/Sys/Syslog lib/Sys lib/Sub lib/Search lib/Scalar
+       -rmdir lib/Pod/Text lib/Pod/Simple lib/Pod/Perldoc lib/Pod/Html
+       -rmdir lib/PerlIO/via lib/PerlIO lib/Perl lib/Parse/CPAN lib/Parse
+       -rmdir lib/Params lib/Net/FTP lib/Module/Load lib/Module/CoreList
+       -rmdir lib/Module lib/Memoize lib/Math/BigRat lib/Math/BigInt
        -rmdir lib/Math/BigFloat lib/Math lib/MIME lib/Locale/Maketext
-       -rmdir lib/Locale/Codes lib/Locale lib/List/Util lib/List lib/JSON/PP
-       -rmdir lib/JSON lib/IPC lib/IO/Uncompress/Adapter lib/IO/Uncompress
-       -rmdir lib/IO/Socket lib/IO/Compress/Zlib lib/IO/Compress/Zip
-       -rmdir lib/IO/Compress/Gzip lib/IO/Compress/Base
-       -rmdir lib/IO/Compress/Adapter lib/IO/Compress lib/IO
-       -rmdir lib/I18N/LangTags lib/I18N lib/Hash/Util lib/Hash lib/HTTP
-       -rmdir lib/Filter/Util lib/Filter lib/File/Spec lib/ExtUtils/Typemaps
-       -rmdir lib/ExtUtils/ParseXS lib/ExtUtils/MakeMaker/version
-       -rmdir lib/ExtUtils/MakeMaker lib/ExtUtils/Liblist
-       -rmdir lib/ExtUtils/Constant lib/ExtUtils/Command
+       -rmdir lib/Locale lib/List/Util lib/List lib/JSON/PP lib/JSON lib/IPC
+       -rmdir lib/IO/Uncompress/Adapter lib/IO/Uncompress lib/IO/Socket
+       -rmdir lib/IO/Compress/Zlib lib/IO/Compress/Zip lib/IO/Compress/Gzip
+       -rmdir lib/IO/Compress/Base lib/IO/Compress/Adapter lib/IO/Compress
+       -rmdir lib/IO lib/I18N/LangTags lib/I18N lib/Hash/Util lib/Hash
+       -rmdir lib/HTTP lib/Getopt/Long lib/Filter/Util lib/Filter
+       -rmdir lib/File/Spec lib/ExtUtils/Typemaps lib/ExtUtils/ParseXS
+       -rmdir lib/ExtUtils/MakeMaker/version lib/ExtUtils/MakeMaker
+       -rmdir lib/ExtUtils/Liblist lib/ExtUtils/Constant lib/ExtUtils/Command
        -rmdir lib/ExtUtils/CBuilder/Platform/Windows
        -rmdir lib/ExtUtils/CBuilder/Platform lib/ExtUtils/CBuilder
        -rmdir lib/Exporter lib/Encode/Unicode lib/Encode/MIME/Header
        -rmdir lib/Encode/MIME lib/Encode/KR lib/Encode/JP lib/Encode/CN
        -rmdir lib/Encode lib/Digest lib/Devel lib/Data lib/Config/Perl
        -rmdir lib/Compress/Raw lib/Compress lib/Carp lib/CPAN/Plugin
-       -rmdir lib/CPAN/Meta/History lib/CPAN/Meta lib/CPAN/LWP
-       -rmdir lib/CPAN/Kwalify lib/CPAN/HTTP lib/CPAN/FTP lib/CPAN/Exception
-       -rmdir lib/CPAN/API lib/CPAN lib/Attribute lib/Archive/Tar lib/Archive
-       -rmdir lib/App/Prove/State/Result lib/App/Prove/State lib/App/Prove
-       -rmdir lib/App lib/Amiga
+       -rmdir lib/CPAN/Meta/Requirements lib/CPAN/Meta/History lib/CPAN/Meta
+       -rmdir lib/CPAN/LWP lib/CPAN/Kwalify lib/CPAN/HTTP lib/CPAN/FTP
+       -rmdir lib/CPAN/Exception lib/CPAN/API lib/CPAN lib/Attribute
+       -rmdir lib/Archive/Tar lib/Archive lib/App/Prove/State/Result
+       -rmdir lib/App/Prove/State lib/App/Prove lib/App lib/Amiga
 
 _realcleaner:
        @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=distclean
@@ -1475,7 +1489,7 @@ cscope.out cscope: $(c) $(h)
 # The README below ensures that the dependency list is never empty and
 # that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
 
-MAKEDEPEND = Makefile makedepend
+MAKEDEPEND = Makefile makedepend_file makedepend
 
 $(FIRSTMAKEFILE):      README $(MAKEDEPEND)
        $(MAKE) depend MAKEDEPEND=
@@ -1496,6 +1510,9 @@ $spitshell >>$Makefile <<'!NO!SUBS!'
 depend: makedepend $(DTRACE_H) $(generated_headers)
        sh ./makedepend MAKE="$(MAKE)" cflags
 
+.c.c.depends:
+       sh ./makedepend_file $< $@ cflags
+
 .PHONY: test check test_prep test_prep_nodll test_prep_pre \
        test_prep_reonly test_tty test-tty test_notty test-notty \
        test_harness test_harness_notty minitest test-reonly _test
@@ -1516,7 +1533,7 @@ test_prep_pre: preplibrary utilities $(nonxs_ext)
 case "$targethost" in
 '') $spitshell >>$Makefile <<'!NO!SUBS!'
 test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
-       $(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods)
+       $(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) common_build
        cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
 
 !NO!SUBS!
@@ -1524,7 +1541,7 @@ test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
 *) $spitshell >>$Makefile <<!GROK!THIS!
 test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE) \
        \$(dynamic_ext) \$(TEST_PERL_DLL) runtests \
-       \$(generated_pods)
+       \$(generated_pods) common_build
        $to libperl.*
        $to t/*
        $to lib/*
@@ -1626,21 +1643,21 @@ $spitshell >>$Makefile <<'!NO!SUBS!'
 
 # minitest can't depend on lib/Config.pm because that might be where miniperl
 # is crashing.
-minitest_prep:
+minitest_prep: $(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 " "
-       cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE))
+       cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE))
 
 MINITEST_TESTS = base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t
 
-minitest: $(MINIPERL_EXE) minitest_prep
-       cd t && $(RUN_PERL) TEST $(MINITEST_TESTS) <$(devtty)
+minitest: minitest_prep
+       cd t && $(RUN_PERL) TEST $(MINITEST_TESTS) <$(devtty)
 
-minitest-notty minitest_notty: $(MINIPERL_EXE) minitest_prep
-       cd t && PERL_SKIP_TTY_TEST=1 $(RUN_PERL) TEST $(MINITEST_TESTS)
+minitest-notty minitest_notty: minitest_prep
+       cd t && PERL_SKIP_TTY_TEST=1 $(RUN_PERL) TEST $(MINITEST_TESTS)
 
 # Test via harness
 
@@ -1651,13 +1668,24 @@ test_harness_notty: test_prep
        HARNESS_NOTTY=1 TESTFILE=harness $(RUN_TESTS) choose
 
 test_reonly test-reonly: test_prep_reonly
-       TEST_ARGS='-re \bre\/' TESTFILE=harness $(RUN_TESTS) choose
+       TEST_ARGS='re/*.t ../ext/re/t/*.t' PERL_TEST_HARNESS_ASAP=1 TESTFILE=harness $(RUN_TESTS) choose
 
 
 # Porting tests (well-formedness of pod, manifest, etc)
 
 test_porting test-porting: test_prep
-       cd t && $(RUN_PERL) harness porting/*.t ../lib/diagnostics.t
+       TEST_ARGS='porting/*.t lib/diagnostics.t' TESTFILE=harness $(RUN_TESTS) choose
+
+!NO!SUBS!
+
+$spitshell>>$Makefile <<!GROK!THIS!
+
+# intended as a common way to add dependencies to test-prep and all
+common_build: $common_build_deps
+
+!GROK!THIS!
+
+$spitshell >>$Makefile <<'!NO!SUBS!'
 
 # 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.
@@ -1704,15 +1732,18 @@ distcheck: FORCE
 
 .PHONY: ctags
 
-TAGS: $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
-       etags $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
+TAGS: $(c_base) $(h)
+       etags $(c_base) $(h)
+!NO!SUBS!
+
+$spitshell >>$Makefile <<!GROK!THIS!
 
 ctags:
-       ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c --exclude=perlmini.c *.c *.h
+       ctags -f Tags -N --totals --languages=c --langmap=c:+.h $ctags_exclude *.c *.h
 
 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
 # If this runs make out of memory, delete /usr/include lines.
-!NO!SUBS!
+!GROK!THIS!
 
 $eunicefix Makefile
 $rm -f $firstmakefile