This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix #123976 Win32 GCC miniperl needs -fno-strict-aliasing
[perl5.git] / win32 / makefile.mk
index 288ce0f..34dd7e9 100644 (file)
@@ -2,17 +2,22 @@
 # Makefile to build perl on Windows using DMAKE.
 # Supported compilers:
 #      Microsoft Visual C++ 6.0 or later
-#      MinGW with gcc-3.2 or later
+#      MinGW with gcc-3.4.5 or later
 #      Windows SDK 64-bit compiler and tools
 #
 # This is set up to build a perl.exe that runs off a shared library
-# (perl519.dll).  Also makes individual DLLs for the XS extensions.
+# (perl521.dll).  Also makes individual DLLs for the XS extensions.
 #
 
 ##
 ## Make sure you read README.win32 *before* you mess with anything here!
 ##
 
+#
+# Import everything from the environment like NMAKE does.
+#
+.IMPORT : .EVERYTHING
+
 ##
 ## Build configuration.  Edit the values below to suit your needs.
 ##
@@ -27,6 +32,7 @@ INST_TOP      *= $(INST_DRV)\perl
 #
 # Uncomment if you want to build a 32-bit Perl using a 32-bit compiler
 # on a 64-bit version of Windows.
+#
 #WIN64         *= undef
 
 #
@@ -38,7 +44,7 @@ INST_TOP      *= $(INST_DRV)\perl
 # versioned installation can be obtained by setting INST_TOP above to a
 # path that includes an arbitrary version string.
 #
-#INST_VER      *= \5.19.3
+#INST_VER      *= \5.21.11
 
 #
 # Comment this out if you DON'T want your perl installation to have
@@ -60,46 +66,48 @@ INST_TOP    *= $(INST_DRV)\perl
 #USE_SITECUST  *= define
 
 #
-# uncomment to enable multiple interpreters.  This is need for fork()
-# emulation and for thread support.
+# uncomment to enable multiple interpreters.  This is needed for fork()
+# emulation and for thread support, and is auto-enabled by USE_IMP_SYS
+# and USE_ITHREADS below.
 #
 USE_MULTI      *= define
 
 #
 # Interpreter cloning/threads; now reasonably complete.
-# This should be enabled to get the fork() emulation.  
-# This needs USE_MULTI above.
+# This should be enabled to get the fork() emulation.  This needs (and
+# will auto-enable) USE_MULTI above.
 #
 USE_ITHREADS   *= define
 
 #
 # uncomment to enable the implicit "host" layer for all system calls
-# made by perl.  This needs USE_MULTI above.  
-# This is also needed to get fork().
+# made by perl.  This is also needed to get fork().  This needs (and
+# will auto-enable) USE_MULTI above.
 #
 USE_IMP_SYS    *= define
 
 #
-# Comment out next assign to disable perl's I/O subsystem and use compiler's 
-# stdio for IO - depending on your compiler vendor and run time library you may 
-# then get a number of fails from make test i.e. bugs - complain to them not us ;-). 
-# You will also be unable to take full advantage of perl5.8's support for multiple 
-# encodings and may see lower IO performance. You have been warned.
-USE_PERLIO     *= define
-
-#
 # Comment this out if you don't want to enable large file support for
 # some reason.  Should normally only be changed to maintain compatibility
 # with an older release of perl.
+#
 USE_LARGE_FILES        *= define
 
 #
 # Uncomment this if you're building a 32-bit perl and want 64-bit integers.
 # (If you're building a 64-bit perl then you will have 64-bit integers whether
 # or not this is uncommented.)
+# Note: This option is not supported in 32-bit MSVC60 builds.
+#
 #USE_64_BIT_INT        *= define
 
 #
+# Uncomment this if you want to support the use of long doubles in GCC builds.
+# This option is not supported for MSVC builds.
+#
+#USE_LONG_DOUBLE *=define
+
+#
 # uncomment exactly one of the following
 #
 # Visual C++ 6.x (aka Visual C++ 98)
@@ -126,14 +134,46 @@ USE_LARGE_FILES   *= define
 #CCTYPE                = MSVC110
 # Visual C++ 2012 Express Edition (aka Visual C++ 11.x) (free version)
 #CCTYPE                = MSVC110FREE
-# MinGW or mingw-w64 with gcc-3.2 or later
+# Visual C++ 2013 (aka Visual C++ 12.x) (full version)
+#CCTYPE                = MSVC120
+# Visual C++ 2013 Express Edition (aka Visual C++ 12.x) (free version)
+#CCTYPE                = MSVC120FREE
+# MinGW or mingw-w64 with gcc-3.4.5 or later
 CCTYPE         *= GCC
 
 #
-# uncomment next line if you want debug version of perl (big,slow)
+# If you are using GCC, 4.3 or later by default we add the -fwrapv option.
+# See https://rt.perl.org/Ticket/Display.html?id=121505
+#
+#GCCWRAPV       *= define
+
+#
+# If you are using Intel C++ Compiler uncomment this
+#
+#__ICC         *= define
+
+#
+# Uncomment this if you want to build everything in C++ mode
+#
+#USE_CPLUSPLUS *= define
+
+#
+# uncomment next line if you want debug version of perl (big/slow)
 # If not enabled, we automatically try to use maximum optimization
 # with all compilers that are known to have a working optimizer.
 #
+# You can also set CFG = DebugSymbols for a slightly smaller/faster
+# debug build without the special debugging code in perl which is
+# enabled via -DDEBUGGING;
+#
+# or you can set CFG = DebugFull for an even fuller (bigger/slower)
+# debug build using the debug version of the CRT, and enabling VC++
+# debug features such as extra assertions and invalid parameter warnings
+# in perl and CRT code via -D_DEBUG.  (Note that the invalid parameter
+# handler does get triggered from time to time in this configuration,
+# which causes warnings to be printed on STDERR, which in turn causes a
+# few tests to fail.)  (This configuration is only available for VC++ builds.)
+#
 #CFG           *= Debug
 
 #
@@ -165,7 +205,7 @@ CCTYPE              *= GCC
 # set this to additionally provide a statically linked perl-static.exe.
 # Note that dynamic loading will not work with this perl, so you must
 # include required modules statically using the STATIC_EXT or ALL_STATIC
-# variables below. A static library perl519s.lib will also be created.
+# variables below. A static library perl521s.lib will also be created.
 # Ordinary perl.exe is not affected by this option.
 #
 #BUILD_STATIC  *= define
@@ -267,9 +307,9 @@ USE_SITECUST        *= undef
 USE_MULTI      *= undef
 USE_ITHREADS   *= undef
 USE_IMP_SYS    *= undef
-USE_PERLIO     *= undef
 USE_LARGE_FILES        *= undef
 USE_64_BIT_INT *= undef
+USE_LONG_DOUBLE        *= undef
 
 .IF "$(USE_IMP_SYS)" == "define"
 PERL_MALLOC    = undef
@@ -303,8 +343,6 @@ BUILDOPT    += -DPERL_IMPLICIT_CONTEXT
 BUILDOPT       += -DPERL_IMPLICIT_SYS
 .ENDIF
 
-.IMPORT .IGNORE : PROCESSOR_ARCHITECTURE PROCESSOR_ARCHITEW6432 WIN64 CCHOME
-
 PROCESSOR_ARCHITECTURE *= x86
 
 .IF "$(WIN64)" == ""
@@ -332,6 +370,18 @@ USE_64_BIT_INT     = define
 CCTYPE         = SDK2003SP1
 .ENDIF
 
+# Disable the 64-bit-int option for (32-bit) MSVC60 builds since that compiler
+# does not support it.
+.IF "$(CCTYPE)" == "MSVC60"
+USE_64_BIT_INT != undef
+.ENDIF
+
+# Disable the long double option for MSVC builds since that compiler
+# does not support it.
+.IF "$(CCTYPE)" != "GCC"
+USE_LONG_DOUBLE        != undef
+.ENDIF
+
 ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
 .IF "$(ARCHITECTURE)" == "AMD64"
 ARCHITECTURE   = x64
@@ -343,15 +393,7 @@ ARCHITECTURE       = ia64
 .IF "$(USE_MULTI)" == "define"
 ARCHNAME       = MSWin32-$(ARCHITECTURE)-multi
 .ELSE
-.IF "$(USE_PERLIO)" == "define"
 ARCHNAME       = MSWin32-$(ARCHITECTURE)-perlio
-.ELSE
-ARCHNAME       = MSWin32-$(ARCHITECTURE)
-.ENDIF
-.ENDIF
-
-.IF "$(USE_PERLIO)" == "define"
-BUILDOPT       += -DUSE_PERLIO
 .ENDIF
 
 .IF "$(USE_ITHREADS)" == "define"
@@ -364,6 +406,10 @@ ARCHNAME   !:= $(ARCHNAME)-64int
 .ENDIF
 .ENDIF
 
+.IF "$(USE_LONG_DOUBLE)" == "define"
+ARCHNAME       !:= $(ARCHNAME)-ld
+.ENDIF
+
 ARCHDIR                = ..\lib\$(ARCHNAME)
 COREDIR                = ..\lib\CORE
 AUTODIR                = ..\lib\auto
@@ -388,6 +434,8 @@ INST_HTML   = $(INST_TOP)$(INST_VER)\html
 
 .USESHELL :
 
+MINIBUILDOPT    *=
+
 .IF "$(CCTYPE)" == "GCC"
 
 .IF "$(GCCCROSS)" == "define"
@@ -400,6 +448,18 @@ LIB32              = $(ARCHPREFIX)ar rc
 IMPLIB         = $(ARCHPREFIX)dlltool
 RSC            = $(ARCHPREFIX)windres
 
+.IF "$(USE_LONG_DOUBLE)" == "define"
+BUILDOPT        += -D__USE_MINGW_ANSI_STDIO
+MINIBUILDOPT    += -D__USE_MINGW_ANSI_STDIO
+.ENDIF
+
+GCCWRAPV *= $(shell for /f "delims=. tokens=1,2,3" %i in ('$(CC) -dumpversion') do @if "%i"=="4" (if "%j" geq "3" echo define) else if "%i" geq "5" (echo define))
+
+.IF "$(GCCWRAPV)" == "define"
+BUILDOPT        += -fwrapv
+MINIBUILDOPT    += -fwrapv
+.ENDIF
+
 i = .i
 o = .o
 a = .a
@@ -432,12 +492,18 @@ LIBFILES  = $(LIBC) \
 .IF  "$(CFG)" == "Debug"
 OPTIMIZE       = -g -O2 -DDEBUGGING
 LINK_DBG       = -g
+.ELIF  "$(CFG)" == "DebugSymbols"
+OPTIMIZE       = -g -O2
+LINK_DBG       = -g
 .ELSE
 OPTIMIZE       = -s -O2
 LINK_DBG       = -s
 .ENDIF
 
 EXTRACFLAGS    =
+.IF "$(USE_CPLUSPLUS)" == "define"
+EXTRACFLAGS    += $(CXX_FLAG)
+.ENDIF
 CFLAGS         = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE)
 LINK_FLAGS     = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)"
 OBJOUT_FLAG    = -o
@@ -445,6 +511,7 @@ EXEOUT_FLAG = -o
 LIBOUT_FLAG    =
 
 BUILDOPT       += -fno-strict-aliasing -mms-bitfields
+MINIBUILDOPT   += -fno-strict-aliasing
 
 .ELSE
 
@@ -473,8 +540,13 @@ PREMSVC80  = define
 PREMSVC80      = undef
 .ENDIF
 
+.IF "$(__ICC)" != "define"
 CC             = cl
 LINK32         = link
+.ELSE
+CC             = icl
+LINK32         = xilink
+.ENDIF
 LIB32          = $(LINK32) -lib
 RSC            = rc
 
@@ -489,11 +561,18 @@ LOCDEFS           = -DPERLDLL -DPERL_CORE
 SUBSYS         = console
 CXX_FLAG       = -TP -EHsc
 
-LIBC   = msvcrt.lib
+LIBC           = msvcrt.lib
 
 .IF  "$(CFG)" == "Debug"
 OPTIMIZE       = -Od -MD -Zi -DDEBUGGING
 LINK_DBG       = -debug
+.ELIF  "$(CFG)" == "DebugSymbols"
+OPTIMIZE       = -Od -MD -Zi
+LINK_DBG       = -debug
+.ELIF  "$(CFG)" == "DebugFull"
+LIBC           = msvcrtd.lib
+OPTIMIZE       = -Od -MDd -Zi -D_DEBUG -DDEBUGGING
+LINK_DBG       = -debug
 .ELSE
 # -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
 OPTIMIZE       = -O1 -MD -Zi -DNDEBUG
@@ -505,10 +584,11 @@ LINK_DBG  = -debug -opt:ref,icf
 # installed to get better stack traces from just the PDB symbols, so we
 # avoid the bloat of COFF symbols by default.
 #LINK_DBG      = $(LINK_DBG) -debugtype:both
-.IF "$(WIN64)" == "define"
+.IF "$(CCTYPE)" != "MSVC60"
 # enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG)
 OPTIMIZE       += -GL
 LINK_DBG       += -ltcg
+LIB_FLAGS      = -ltcg
 .ENDIF
 .ENDIF
 
@@ -543,6 +623,14 @@ LIBBASEFILES       = \
                netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib \
                version.lib odbc32.lib odbccp32.lib comctl32.lib
 
+# Avoid __intel_new_proc_init link error for libircmt.
+# libmmd is /MD equivelent, other variants exist.
+# libmmd is Intel C's math addon funcs to MS CRT, contains long doubles, C99,
+# and optimized C89 funcs
+.IF "$(__ICC)" == "define"
+LIBBASEFILES   += libircmt.lib libmmd.lib
+.ENDIF
+
 # The 64 bit Windows Server 2003 SP1 SDK compilers link against MSVCRT.dll, which
 # doesn't include the buffer overrun verification code used by the /GS switch.
 # Since the code links against libraries that are compiled with /GS, this
@@ -554,12 +642,18 @@ LIBBASEFILES    += bufferoverflowU.lib
 LIBFILES       = $(LIBBASEFILES) $(LIBC)
 
 EXTRACFLAGS    = -nologo -GF -W3
+.IF "$(__ICC)" == "define"
+EXTRACFLAGS    += -Qstd=c99
+.ENDIF
+.IF "$(USE_CPLUSPLUS)" == "define"
+EXTRACFLAGS    += $(CXX_FLAG)
+.ENDIF
 CFLAGS         = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \
                $(PCHFLAGS) $(OPTIMIZE)
 LINK_FLAGS     = -nologo -nodefaultlib $(LINK_DBG) \
                -libpath:"$(INST_COREDIR)" \
                -machine:$(PROCESSOR_ARCHITECTURE)
-LIB_FLAGS      = -nologo
+LIB_FLAGS      = $(LIB_FLAGS) -nologo
 OBJOUT_FLAG    = -Fo
 EXEOUT_FLAG    = -Fe
 LIBOUT_FLAG    = /out:
@@ -643,7 +737,6 @@ PERLEXESTATIC       = ..\perl-static.exe
 STATICDIR      = .\static.tmp
 GLOBEXE                = ..\perlglob.exe
 CONFIGPM       = ..\lib\Config.pm ..\lib\Config_heavy.pl
-X2P            = ..\x2p\a2p.exe
 GENUUDMAP      = ..\generate_uudmap.exe
 .IF "$(BUILD_STATIC)" == "define" || "$(ALL_STATIC)" == "define"
 PERLSTATIC     = static
@@ -687,8 +780,8 @@ UTILS               =                       \
                ..\utils\perlivp        \
                ..\utils\libnetcfg      \
                ..\utils\enc2xs         \
+               ..\utils\encguess               \
                ..\utils\piconv         \
-               ..\utils\config_data    \
                ..\utils\corelist       \
                ..\utils\cpan           \
                ..\utils\xsubpp         \
@@ -701,9 +794,6 @@ UTILS               =                       \
                ..\utils\shasum         \
                ..\utils\instmodsh      \
                ..\utils\json_pp        \
-               ..\x2p\find2perl        \
-               ..\x2p\psed             \
-               ..\x2p\s2p              \
                bin\exetype.pl          \
                bin\runperl.pl          \
                bin\pl2bat.pl           \
@@ -714,25 +804,23 @@ UTILS             =                       \
 
 CFGSH_TMPL     = config.gc
 CFGH_TMPL      = config_H.gc
-PERLIMPLIB     = ..\libperl519$(a)
-PERLSTATICLIB  = ..\libperl519s$(a)
+PERLIMPLIB     = ..\libperl521$(a)
+PERLSTATICLIB  = ..\libperl521s$(a)
 INT64          = long long
-INT64f         = ll
 
 .ELSE
 
 CFGSH_TMPL     = config.vc
 CFGH_TMPL      = config_H.vc
 INT64          = __int64
-INT64f         = I64
 
 .ENDIF
 
 # makedef.pl must be updated if this changes, and this should normally
 # only change when there is an incompatible revision of the public API.
-PERLIMPLIB     *= ..\perl519$(a)
-PERLSTATICLIB  *= ..\perl519s$(a)
-PERLDLL                = ..\perl519.dll
+PERLIMPLIB     *= ..\perl521$(a)
+PERLSTATICLIB  *= ..\perl521s$(a)
+PERLDLL                = ..\perl521.dll
 
 XCOPY          = xcopy /f /r /i /d /y
 RCOPY          = xcopy /f /r /i /e /d /y
@@ -740,13 +828,14 @@ NOOP              = @rem
 
 MICROCORE_SRC  =               \
                ..\av.c         \
+               ..\caretx.c     \
                ..\deb.c        \
                ..\doio.c       \
                ..\doop.c       \
                ..\dump.c       \
                ..\globals.c    \
                ..\gv.c         \
-               ..\mro.c        \
+               ..\mro_core.c   \
                ..\hv.c         \
                ..\locale.c     \
                ..\keywords.c   \
@@ -786,23 +875,11 @@ EXTRACORE_SRC     += ..\perlio.c
 
 WIN32_SRC      =               \
                .\win32.c       \
+               .\win32io.c     \
                .\win32sck.c    \
                .\win32thread.c \
                .\fcrypt.c
 
-# We need this for miniperl build unless we override canned 
-# config.h #define building mini\*
-#.IF "$(USE_PERLIO)" == "define"
-WIN32_SRC      += .\win32io.c
-#.ENDIF
-
-X2P_SRC                =               \
-               ..\x2p\a2p.c    \
-               ..\x2p\hash.c   \
-               ..\x2p\str.c    \
-               ..\x2p\util.c   \
-               ..\x2p\walk.c
-
 CORE_NOCFG_H   =               \
                ..\av.h         \
                ..\cop.h        \
@@ -813,6 +890,7 @@ CORE_NOCFG_H        =               \
                ..\gv.h         \
                ..\handy.h      \
                ..\hv.h         \
+               ..\hv_func.h    \
                ..\iperlsys.h   \
                ..\mg.h         \
                ..\nostdio.h    \
@@ -821,7 +899,6 @@ CORE_NOCFG_H        =               \
                ..\perl.h       \
                ..\perlapi.h    \
                ..\perlsdio.h   \
-               ..\perlsfio.h   \
                ..\perly.h      \
                ..\pp.h         \
                ..\proto.h      \
@@ -840,6 +917,7 @@ CORE_NOCFG_H        =               \
                ..\intrpvar.h   \
                .\include\dirent.h      \
                .\include\netdb.h       \
+               .\include\sys\errno2.h  \
                .\include\sys\socket.h  \
                .\win32.h
 
@@ -857,7 +935,6 @@ MINICORE_OBJ        = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)}
 MINIWIN32_OBJ  = $(MINIDIR)\{$(WIN32_OBJ:f)}
 MINI_OBJ       = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
 DLL_OBJ                = $(DYNALOADER)
-X2P_OBJ                = $(X2P_SRC:db:+$(o))
 GENUUDMAP_OBJ  = $(GENUUDMAP:db:+$(o))
 
 PERLDLL_OBJ    = $(CORE_OBJ)
@@ -895,6 +972,7 @@ CFG_VARS    =                                       \
                cc=$(CC)                        ~       \
                ld=$(LINK32)                    ~       \
                ccflags=$(EXTRACFLAGS) $(OPTIMIZE) $(DEFINES) $(BUILDOPT)       ~       \
+               usecplusplus=$(USE_CPLUSPLUS)   ~       \
                cf_email=$(EMAIL)               ~       \
                d_mymalloc=$(PERL_MALLOC)       ~       \
                libs=$(LIBFILES:f)              ~       \
@@ -911,8 +989,8 @@ CFG_VARS    =                                       \
                usethreads=$(USE_ITHREADS)      ~       \
                useithreads=$(USE_ITHREADS)     ~       \
                usemultiplicity=$(USE_MULTI)    ~       \
-               useperlio=$(USE_PERLIO)         ~       \
                use64bitint=$(USE_64_BIT_INT)   ~       \
+               uselongdouble=$(USE_LONG_DOUBLE)        ~       \
                uselargefiles=$(USE_LARGE_FILES)        ~       \
                usesitecustomize=$(USE_SITECUST)        ~       \
                LINK_FLAGS=$(LINK_FLAGS)        ~       \
@@ -926,7 +1004,7 @@ CFG_VARS   =                                       \
 
 all : CHECKDMAKE .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL)    \
        $(CONFIGPM) $(UNIDATAFILES) MakePPPort                          \
-       $(PERLEXE) $(X2P) Extensions Extensions_nonxs $(PERLSTATIC)
+       $(PERLEXE) Extensions Extensions_nonxs $(PERLSTATIC)
 
 regnodes : ..\regnodes.h
 
@@ -936,7 +1014,7 @@ regnodes : ..\regnodes.h
 
 reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL)   \
        $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE)                          \
-       $(X2P) Extensions_reonly
+       Extensions_reonly
 
 static: $(PERLEXESTATIC)
 
@@ -980,11 +1058,15 @@ config.w32 : $(CFGSH_TMPL)
        @echo.>>$@
        @echo #ifndef _config_h_footer_>>$@
        @echo #define _config_h_footer_>>$@
+       @echo #undef Off_t>>$@
+       @echo #undef LSEEKSIZE>>$@
+       @echo #undef Off_t_size>>$@
        @echo #undef PTRSIZE>>$@
        @echo #undef SSize_t>>$@
        @echo #undef HAS_ATOLL>>$@
        @echo #undef HAS_STRTOLL>>$@
        @echo #undef HAS_STRTOULL>>$@
+       @echo #undef Size_t_size>>$@
        @echo #undef IVTYPE>>$@
        @echo #undef UVTYPE>>$@
        @echo #undef IVSIZE>>$@
@@ -997,7 +1079,35 @@ config.w32 : $(CFGSH_TMPL)
        @echo #undef UVxf>>$@
        @echo #undef UVXf>>$@
        @echo #undef USE_64_BIT_INT>>$@
-       @echo #undef Size_t_size>>$@
+       @echo #undef Gconvert>>$@
+       @echo #undef HAS_FREXPL>>$@
+       @echo #undef HAS_ISNANL>>$@
+       @echo #undef HAS_MODFL>>$@
+       @echo #undef HAS_MODFL_PROTO>>$@
+       @echo #undef HAS_SQRTL>>$@
+       @echo #undef HAS_STRTOLD>>$@
+       @echo #undef PERL_PRIfldbl>>$@
+       @echo #undef PERL_PRIgldbl>>$@
+       @echo #undef PERL_PRIeldbl>>$@
+       @echo #undef PERL_SCNfldbl>>$@
+       @echo #undef NVTYPE>>$@
+       @echo #undef NVSIZE>>$@
+       @echo #undef LONG_DOUBLESIZE>>$@
+       @echo #undef NV_OVERFLOWS_INTEGERS_AT>>$@
+       @echo #undef NVef>>$@
+       @echo #undef NVff>>$@
+       @echo #undef NVgf>>$@
+       @echo #undef USE_LONG_DOUBLE>>$@
+       @echo #undef USE_CPLUSPLUS>>$@
+.IF "$(USE_LARGE_FILES)"=="define"
+       @echo #define Off_t $(INT64)>>$@
+       @echo #define LSEEKSIZE ^8>>$@
+       @echo #define Off_t_size ^8>>$@
+.ELSE
+       @echo #define Off_t long>>$@
+       @echo #define LSEEKSIZE ^4>>$@
+       @echo #define Off_t_size ^4>>$@
+.ENDIF
 .IF "$(WIN64)"=="define"
        @echo #define PTRSIZE ^8>>$@
        @echo #define SSize_t $(INT64)>>$@
@@ -1018,13 +1128,18 @@ config.w32 : $(CFGSH_TMPL)
        @echo #define UVTYPE unsigned $(INT64)>>$@
        @echo #define IVSIZE ^8>>$@
        @echo #define UVSIZE ^8>>$@
+.IF "$(USE_LONG_DOUBLE)"=="define"
+       @echo #define NV_PRESERVES_UV>>$@
+       @echo #define NV_PRESERVES_UV_BITS 64>>$@
+.ELSE
        @echo #undef NV_PRESERVES_UV>>$@
        @echo #define NV_PRESERVES_UV_BITS 53>>$@
-       @echo #define IVdf "$(INT64f)d">>$@
-       @echo #define UVuf "$(INT64f)u">>$@
-       @echo #define UVof "$(INT64f)o">>$@
-       @echo #define UVxf "$(INT64f)x">>$@
-       @echo #define UVXf "$(INT64f)X">>$@
+.ENDIF
+       @echo #define IVdf "I64d">>$@
+       @echo #define UVuf "I64u">>$@
+       @echo #define UVof "I64o">>$@
+       @echo #define UVxf "I64x">>$@
+       @echo #define UVXf "I64X">>$@
        @echo #define USE_64_BIT_INT>>$@
 .ELSE
        @echo #define IVTYPE long>>$@
@@ -1040,6 +1155,57 @@ config.w32 : $(CFGSH_TMPL)
        @echo #define UVXf "lX">>$@
        @echo #undef USE_64_BIT_INT>>$@
 .ENDIF
+.IF "$(USE_LONG_DOUBLE)"=="define"
+       @echo #define Gconvert(x,n,t,b) sprintf((b),"%.*""Lg",(n),(x))>>$@
+       @echo #define HAS_FREXPL>>$@
+       @echo #define HAS_ISNANL>>$@
+       @echo #define HAS_MODFL>>$@
+       @echo #define HAS_MODFL_PROTO>>$@
+       @echo #define HAS_SQRTL>>$@
+       @echo #define HAS_STRTOLD>>$@
+       @echo #define PERL_PRIfldbl "Lf">>$@
+       @echo #define PERL_PRIgldbl "Lg">>$@
+       @echo #define PERL_PRIeldbl "Le">>$@
+       @echo #define PERL_SCNfldbl "Lf">>$@
+       @echo #define NVTYPE long double>>$@
+.IF "$(WIN64)"=="define"
+       @echo #define NVSIZE ^16>>$@
+       @echo #define LONG_DOUBLESIZE ^16>>$@
+.ELSE
+       @echo #define NVSIZE ^12>>$@
+       @echo #define LONG_DOUBLESIZE ^12>>$@
+.ENDIF
+       @echo #define NV_OVERFLOWS_INTEGERS_AT 256.0*256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0*2.0*2.0*2.0>>$@
+       @echo #define NVef "Le">>$@
+       @echo #define NVff "Lf">>$@
+       @echo #define NVgf "Lg">>$@
+       @echo #define USE_LONG_DOUBLE>>$@
+.ELSE
+       @echo #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))>>$@
+       @echo #undef HAS_FREXPL>>$@
+       @echo #undef HAS_ISNANL>>$@
+       @echo #undef HAS_MODFL>>$@
+       @echo #undef HAS_MODFL_PROTO>>$@
+       @echo #undef HAS_SQRTL>>$@
+       @echo #undef HAS_STRTOLD>>$@
+       @echo #undef PERL_PRIfldbl>>$@
+       @echo #undef PERL_PRIgldbl>>$@
+       @echo #undef PERL_PRIeldbl>>$@
+       @echo #undef PERL_SCNfldbl>>$@
+       @echo #define NVTYPE double>>$@
+       @echo #define NVSIZE ^8>>$@
+       @echo #define LONG_DOUBLESIZE ^8>>$@
+       @echo #define NV_OVERFLOWS_INTEGERS_AT 256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0>>$@
+       @echo #define NVef "e">>$@
+       @echo #define NVff "f">>$@
+       @echo #define NVgf "g">>$@
+       @echo #undef USE_LONG_DOUBLE>>$@
+.ENDIF
+.IF "$(USE_CPLUSPLUS)"=="define"
+       @echo #define USE_CPLUSPLUS>>$@
+.ELSE
+       @echo #undef USE_CPLUSPLUS>>$@
+.ENDIF
        @echo #endif>>$@
 
 ..\git_version.h : $(MINIPERL) ..\make_patchnum.pl
@@ -1054,7 +1220,7 @@ config.w32 : $(CFGSH_TMPL)
 
 # This target is for when changes to the main config.sh happen.
 # Edit config.gc, then make perl using GCC in a minimal configuration (i.e.
-# with MULTI, ITHREADS, IMP_SYS, LARGE_FILES and PERLIO off), then make
+# with MULTI, ITHREADS, IMP_SYS and LARGE_FILES off), then make
 # this target to regenerate config_H.gc.
 regen_config_h:
        $(MINIPERL) -I..\lib config_sh.PL --cfgsh-option-file $(mktmp $(CFG_VARS)) \
@@ -1066,7 +1232,6 @@ regen_config_h:
 
 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL
        $(MINIPERL) -I..\lib ..\configpm --chdir=..
-       if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
        $(XCOPY) ..\*.h $(COREDIR)\*.*
        $(XCOPY) *.h $(COREDIR)\*.*
        $(RCOPY) include $(COREDIR)\*.*
@@ -1083,7 +1248,7 @@ $(MINIPERL) : ..\lib\buildcustomize.pl
 .ELSE
        $(LINK32) -subsystem:console -out:$(MINIPERL) $(BLINK_FLAGS) \
            @$(mktmp $(DELAYLOAD) $(LIBFILES) $(MINI_OBJ))
-       $(EMBED_EXE_MANI)
+       $(EMBED_EXE_MANI:s/$@/$(MINIPERL)/)
 .ENDIF
        $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl ..
 
@@ -1091,10 +1256,10 @@ $(MINIDIR) :
        if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
 
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-       $(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
+       $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-       $(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*B).c
+       $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*B).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
@@ -1119,8 +1284,6 @@ $(CORE_OBJ)       : $(CORE_H)
 
 $(DLL_OBJ)     : $(CORE_H)
 
-$(X2P_OBJ)     : $(CORE_H)
-
 perldll.def : $(MINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl
        $(MINIPERL) -I..\lib create_perllibst_h.pl
        $(MINIPERL) -I..\lib -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
@@ -1167,33 +1330,6 @@ $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
 
 $(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
 
-..\x2p\a2p$(o) : ..\x2p\a2p.c
-       $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
-
-..\x2p\hash$(o) : ..\x2p\hash.c
-       $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c
-
-..\x2p\str$(o) : ..\x2p\str.c
-       $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c
-
-..\x2p\util$(o) : ..\x2p\util.c
-       $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c
-
-..\x2p\walk$(o) : ..\x2p\walk.c
-       $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c
-
-$(X2P) : $(MINIPERL) $(X2P_OBJ) Extensions
-       $(MINIPERL) -I..\lib ..\x2p\find2perl.PL
-       $(MINIPERL) -I..\lib ..\x2p\s2p.PL
-.IF "$(CCTYPE)" == "GCC"
-       $(LINK32) -v -o $@ $(BLINK_FLAGS) \
-           $(mktmp $(LKPRE) $(X2P_OBJ) $(LIBFILES) $(LKPOST))
-.ELSE
-       $(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) \
-           @$(mktmp $(LIBFILES) $(X2P_OBJ))
-       $(EMBED_EXE_MANI)
-.ENDIF
-
 $(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
 
 $(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
@@ -1261,7 +1397,7 @@ Extensions_reonly : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGP
        $(XCOPY) ..\*.h $(COREDIR)\*.*
        $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
 
-Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
+Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
        $(XCOPY) ..\*.h $(COREDIR)\*.*
        $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
        $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
@@ -1284,7 +1420,7 @@ Extensions_realclean :
 
 
 doc: $(PERLEXE) ..\pod\perltoc.pod
-       $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
+       $(PERLEXE) ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
            --podpath=pod:lib:utils --htmlroot="file://$(INST_HTML:s,:,|,)"\
            --recurse
 
@@ -1293,10 +1429,11 @@ doc: $(PERLEXE) ..\pod\perltoc.pod
 
 # Note that this next section is parsed (and regenerated) by pod/buildtoc
 # so please check that script before making structural changes here
-utils: $(PERLEXE) $(X2P) ..\utils\Makefile
+utils: $(PERLEXE) ..\utils\Makefile
        cd ..\utils && $(MAKE) PERL=$(MINIPERL)
        copy ..\README.aix      ..\pod\perlaix.pod
        copy ..\README.amiga    ..\pod\perlamiga.pod
+       copy ..\README.android  ..\pod\perlandroid.pod
        copy ..\README.bs2000   ..\pod\perlbs2000.pod
        copy ..\README.ce       ..\pod\perlce.pod
        copy ..\README.cn       ..\pod\perlcn.pod
@@ -1322,11 +1459,12 @@ utils: $(PERLEXE) $(X2P) ..\utils\Makefile
        copy ..\README.riscos   ..\pod\perlriscos.pod
        copy ..\README.solaris  ..\pod\perlsolaris.pod
        copy ..\README.symbian  ..\pod\perlsymbian.pod
+       copy ..\README.synology ..\pod\perlsynology.pod
        copy ..\README.tru64    ..\pod\perltru64.pod
        copy ..\README.tw       ..\pod\perltw.pod
        copy ..\README.vos      ..\pod\perlvos.pod
        copy ..\README.win32    ..\pod\perlwin32.pod
-       copy ..\pod\perldelta.pod ..\pod\perl5193delta.pod
+       copy ..\pod\perldelta.pod ..\pod\perl52111delta.pod
        $(PERLEXE) $(PL2BAT) $(UTILS)
        $(MINIPERL) -I..\lib ..\autodoc.pl ..
        $(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
@@ -1340,7 +1478,6 @@ utils: $(PERLEXE) $(X2P) ..\utils\Makefile
 distclean: realclean
        -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
                $(PERLIMPLIB) ..\miniperl$(a) $(PERLEXESTATIC) $(PERLSTATICLIB)
-       -del /f *.def *.map
        -del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm
        -del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm
        -del /f $(LIBDIR)\.exists $(LIBDIR)\attributes.pm $(LIBDIR)\DynaLoader.pm
@@ -1360,76 +1497,81 @@ distclean: realclean
        -del /f $(LIBDIR)\Win32API\File\cFile.pc
        -del /f $(LIBDIR)\buildcustomize.pl
        -del /f $(DISTDIR)\XSLoader\XSLoader.pm
+       -del /f *.def *.map
        -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App
        -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive
        -if exist $(LIBDIR)\Attribute rmdir /s /q $(LIBDIR)\Attribute
        -if exist $(LIBDIR)\autodie rmdir /s /q $(LIBDIR)\autodie
-       -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B
-       -if exist $(LIBDIR)\CGI rmdir /s /q $(LIBDIR)\CGI
-       -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN
+       -if exist $(LIBDIR)\Carp rmdir /s /q $(LIBDIR)\Carp
        -if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress
+       -if exist $(LIBDIR)\Config\Perl rmdir /s /q $(LIBDIR)\Config\Perl
+       -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN
        -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
        -if exist $(LIBDIR)\Devel rmdir /s /q $(LIBDIR)\Devel
        -if exist $(LIBDIR)\Digest rmdir /s /q $(LIBDIR)\Digest
        -if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode
        -if exist $(LIBDIR)\encoding rmdir /s /q $(LIBDIR)\encoding
+       -if exist $(LIBDIR)\Exporter rmdir /s /q $(LIBDIR)\Exporter
        -if exist $(LIBDIR)\ExtUtils\CBuilder rmdir /s /q $(LIBDIR)\ExtUtils\CBuilder
        -if exist $(LIBDIR)\ExtUtils\Command rmdir /s /q $(LIBDIR)\ExtUtils\Command
        -if exist $(LIBDIR)\ExtUtils\Constant rmdir /s /q $(LIBDIR)\ExtUtils\Constant
        -if exist $(LIBDIR)\ExtUtils\Liblist rmdir /s /q $(LIBDIR)\ExtUtils\Liblist
        -if exist $(LIBDIR)\ExtUtils\MakeMaker rmdir /s /q $(LIBDIR)\ExtUtils\MakeMaker
+       -if exist $(LIBDIR)\ExtUtils\ParseXS rmdir /s /q $(LIBDIR)\ExtUtils\ParseXS
+       -if exist $(LIBDIR)\ExtUtils\Typemaps rmdir /s /q $(LIBDIR)\ExtUtils\Typemaps
        -if exist $(LIBDIR)\File\Spec rmdir /s /q $(LIBDIR)\File\Spec
        -if exist $(LIBDIR)\Filter rmdir /s /q $(LIBDIR)\Filter
        -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash
-       -if exist $(LIBDIR)\I18N\LangTags rmdir /s /q $(LIBDIR)\I18N\LangTags
-       -if exist $(LIBDIR)\inc rmdir /s /q $(LIBDIR)\inc
-       -if exist $(LIBDIR)\Module\Pluggable rmdir /s /q $(LIBDIR)\Module\Pluggable
+       -if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP
+       -if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N
        -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
        -if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC
+       -if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON
        -if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List
        -if exist $(LIBDIR)\Locale rmdir /s /q $(LIBDIR)\Locale
-       -if exist $(LIBDIR)\Log rmdir /s /q $(LIBDIR)\Log
        -if exist $(LIBDIR)\Math rmdir /s /q $(LIBDIR)\Math
        -if exist $(LIBDIR)\Memoize rmdir /s /q $(LIBDIR)\Memoize
        -if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME
        -if exist $(LIBDIR)\Module rmdir /s /q $(LIBDIR)\Module
-       -if exist $(LIBDIR)\mro rmdir /s /q $(LIBDIR)\mro
        -if exist $(LIBDIR)\Net\FTP rmdir /s /q $(LIBDIR)\Net\FTP
-       -if exist $(LIBDIR)\Object rmdir /s /q $(LIBDIR)\Object
-       -if exist $(LIBDIR)\Package rmdir /s /q $(LIBDIR)\Package
        -if exist $(LIBDIR)\Params rmdir /s /q $(LIBDIR)\Params
        -if exist $(LIBDIR)\Parse rmdir /s /q $(LIBDIR)\Parse
+       -if exist $(LIBDIR)\Perl rmdir /s /q $(LIBDIR)\Perl
        -if exist $(LIBDIR)\PerlIO rmdir /s /q $(LIBDIR)\PerlIO
        -if exist $(LIBDIR)\Pod\Perldoc rmdir /s /q $(LIBDIR)\Pod\Perldoc
        -if exist $(LIBDIR)\Pod\Simple rmdir /s /q $(LIBDIR)\Pod\Simple
        -if exist $(LIBDIR)\Pod\Text rmdir /s /q $(LIBDIR)\Pod\Text
-       -if exist $(LIBDIR)\re rmdir /s /q $(LIBDIR)\re
        -if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar
+       -if exist $(LIBDIR)\Search rmdir /s /q $(LIBDIR)\Search
+       -if exist $(LIBDIR)\Sub rmdir /s /q $(LIBDIR)\Sub
        -if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys
        -if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP
-       -if exist $(LIBDIR)\Term\UI rmdir /s /q $(LIBDIR)\Term\UI
+       -if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term
        -if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
+       -if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text
        -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
        -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
        -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash
        -if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate
+       -if exist $(LIBDIR)\Unicode\Collate\Locale rmdir /s /q $(LIBDIR)\Unicode\Collate\Locale
        -if exist $(LIBDIR)\version rmdir /s /q $(LIBDIR)\version
-       -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
+       -if exist $(LIBDIR)\VMS rmdir /s /q $(LIBDIR)\VMS
        -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
+       -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
        -cd $(PODDIR) && del /f *.html *.bat roffitall \
-           perl5193delta.pod perlaix.pod perlamiga.pod perlapi.pod \
-           perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod perldos.pod \
-           perlfreebsd.pod perlhaiku.pod perlhpux.pod perlhurd.pod \
-           perlintern.pod perlirix.pod perljp.pod perlko.pod perllinux.pod \
-           perlmacos.pod perlmacosx.pod perlmodlib.pod perlnetware.pod \
-           perlopenbsd.pod perlos2.pod perlos390.pod perlos400.pod \
-           perlplan9.pod perlqnx.pod perlriscos.pod perlsolaris.pod \
-           perlsymbian.pod perltoc.pod perltru64.pod perltw.pod \
-           perluniprops.pod perlvos.pod perlwin32.pod
+           perl52111delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
+           perlapi.pod perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
+           perldos.pod perlfreebsd.pod perlhaiku.pod perlhpux.pod \
+           perlhurd.pod perlintern.pod perlirix.pod perljp.pod perlko.pod \
+           perllinux.pod perlmacos.pod perlmacosx.pod perlmodlib.pod \
+           perlnetware.pod perlopenbsd.pod perlos2.pod perlos390.pod \
+           perlos400.pod perlplan9.pod perlqnx.pod perlriscos.pod \
+           perlsolaris.pod perlsymbian.pod perlsynology.pod perltoc.pod \
+           perltru64.pod perltw.pod perluniprops.pod perlvos.pod \
+           perlwin32.pod
        -cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
-           perldoc perlivp libnetcfg enc2xs piconv cpan *.bat \
-           xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist config_data zipdetails
-       -cd ..\x2p && del /f find2perl s2p psed *.bat
+           perldoc perlivp libnetcfg enc2xs encguess piconv cpan *.bat \
+           xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
        -del /f ..\config.sh perlmain.c dlutils.c config.h.new \
            perlmainst.c
        -del /f $(CONFIGPM)
@@ -1437,7 +1579,7 @@ distclean: realclean
        -del /f bin\*.bat
        -del /f perllibst.h
        -del /f $(PERLEXE_RES) perl.base
-       -cd .. && del /s *$(a) *.map *.pdb *.ilk *.tds *.bs *$(o) .exists pm_to_blib ppport.h
+       -cd .. && del /s *$(a) *.map *.pdb *.ilk *.bs *$(o) .exists pm_to_blib ppport.h
        -cd $(EXTDIR) && del /s *.def Makefile Makefile.old
        -cd $(DISTDIR) && del /s *.def Makefile Makefile.old
        -cd $(CPANDIR) && del /s *.def Makefile Makefile.old
@@ -1456,7 +1598,6 @@ installbare : utils ..\pod\perltoc.pod
        if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\*.*
        $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
        if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\*.*
-       if exist ..\x2p\a2p.pdb $(XCOPY) ..\x2p\a2p.pdb $(INST_BIN)\*.*
        $(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
 
 installhtml : doc
@@ -1467,63 +1608,68 @@ inst_lib : $(CONFIGPM)
 
 $(UNIDATAFILES) ..\pod\perluniprops.pod .UPDATEALL : $(MINIPERL) $(CONFIGPM) ..\lib\unicore\mktables Extensions_nonxs
        cd ..\lib\unicore && \
-       ..\$(MINIPERL) -I.. -I..\..\dist\Cwd\lib -I..\..\dist\Cwd mktables -P ..\..\pod -maketest -makelist -p
+       ..\$(MINIPERL) -I.. mktables -P ..\..\pod -maketest -makelist -p
 
-minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
+minitest : .\config.h $(MINIPERL) ..\git_version.h $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) $(TESTPREPGCC)
        $(XCOPY) $(MINIPERL) ..\t\$(NULL)
        if exist ..\t\perl.exe del /f ..\t\perl.exe
        rename ..\t\miniperl.exe perl.exe
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
-       attrib -r ..\t\*.*
-       cd ..\t && \
-       $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
+# Note this perl.exe is miniperl
+       cd ..\t && perl.exe TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t pragma/*.t
 
-test-prep : all utils ..\pod\perltoc.pod
+test-prep : all utils ..\pod\perltoc.pod $(TESTPREPGCC)
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
-.IF "$(CCTYPE)" == "GCC"
+
 # If building with gcc versions 4.x.x or greater, then
 # the GCC helper DLL will also need copied to the test directory.
 # The name of the dll can change, depending upon which vendor has supplied
 # your compiler, and upon the values of "x".
 # libstdc++-6.dll is copied if it exists as it, too, may then be needed.
 # Without this copying, the op/taint.t test script will fail.
+
+.IF "$(CCTYPE)" == "GCC"
+TESTPREPGCC    = test-prep-gcc
+test-prep-gcc :
+       if exist $(CCDLLDIR)\libgcc_s_seh-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_seh-1.dll ..\t\$(NULL)
        if exist $(CCDLLDIR)\libgcc_s_sjlj-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_sjlj-1.dll ..\t\$(NULL)
        if exist $(CCDLLDIR)\libgcc_s_dw2-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_dw2-1.dll ..\t\$(NULL)
        if exist $(CCDLLDIR)\libstdc++-6.dll $(XCOPY) $(CCDLLDIR)\libstdc++-6.dll ..\t\$(NULL)
+       if exist $(CCDLLDIR)\libwinpthread-1.dll $(XCOPY) $(CCDLLDIR)\libwinpthread-1.dll ..\t\$(NULL)
+.ELSE
+TESTPREPGCC    =
 .ENDIF
 
 test : test-prep
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
-           cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
 
 test_porting : test-prep
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
-           cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
 
 test-reonly : reonly utils
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
-       cd ..\t && \
-       $(PERLEXE) -I..\lib harness $(OPT) -re \bpat\\/ $(EXTRA) && \
-       cd ..\win32
+       cd ..\t && perl.exe harness $(OPT) -re \bpat\\/ $(EXTRA)
 
 regen :
-       cd .. && regen.pl && cd win32
+       cd .. && regen.pl
 
 test-notty : test-prep
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
            set PERL_SKIP_TTY_TEST=1 && \
-           cd ..\t && $(PERLEXE) -I.\lib harness $(TEST_SWITCHES) $(TEST_FILES)
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
 
 _test :
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
-           cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
 
 _clean :
        -@erase miniperlmain$(o)
@@ -1548,13 +1694,10 @@ _clean :
        -@erase $(UNIDATAFILES)
        -@erase $(WIN32_OBJ)
        -@erase $(DLL_OBJ)
-       -@erase $(X2P_OBJ)
        -@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp *.res
        -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
-       -@erase ..\x2p\*.exe ..\x2p\*.bat
        -@erase *.ilk
        -@erase *.pdb
-       -@erase *.tds
        -@erase Extensions_static
 
 
@@ -1568,13 +1711,13 @@ realclean : Extensions_realclean _clean
 # Please *don't* use this unless all tests pass.
 # If you want to report test failures, use "dmake nok" instead.
 ok: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)"
+       $(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)"
 
 okfile: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
+       $(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
 
 nok: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)"
+       $(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)"
 
 nokfile: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok
+       $(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok