In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/049e0eb31f8abf40e06ee60ffc0b14ffd0991771?hp=48458f6935316bb1d6fa1746b41a9d05bc87a286>

- Log -----------------------------------------------------------------
commit 049e0eb31f8abf40e06ee60ffc0b14ffd0991771
Merge: 48458f6 c2c7bda
Author: Tony Cook <t...@develop-help.com>
Date:   Mon Sep 7 14:14:00 2015 +1000

    Support parallel builds on Win32 with dmake

commit c2c7bda0885d19e01f0d998f22d2248d7663e957
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Sat Aug 15 05:39:55 2015 -0400

    add parallel support 4 Win32 dmake-uudmap+no 2nd run of config_h.PL part 3
    
    -in $(CONFIGPM) target, remove config_h.PL running dmake again to rebuild
     $(CONFIGPM) target, configpm the script does not use config.h as input.
     The $(CONFIGPM) target is a choke/serialization point for parallel
     building, so it is high value to make it as fast as possible.
     Maybe a long time ago, configpm read config.h but it doesn't anymore.
     Nearly all the dynamic config vars are determined in config_sh.PL script
     and ..\config.sh target. config_h.PL contains very little logic, and this
     logic is only for config.h, and only when you want a var to be different
     in config.h than it is in Config.pm/Config_heavy.pl. Putting a breakpoint
     ("system 'pause';") in config_h.PL, copying Config.pm/Config_heavy.pl to
     ".old" versions, continuing execution in config_h.PL, then diffing the
     2 new Configs with the old 2 Configs before pre-config_h.PL and
     "$(PLMAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)" shows no differece.
     When dmake runs needlessly a 2nd time it emits a warning that nothing
     changed. This is intentional, since configpm doesn't update the timestamps
     /update the files if the Config files are identical to the old ones to
     prevent mass clean+rebuild of all modules when nothing global changed.
    
    dmake:  Warning: -- Target [..\lib\Config.pm] was made but the time stamp
    has not been updated.
    
    -reduce number of steps to build generate_uudmap.exe.
     Compiling (140 ms on GCC 4.8.3) and linking (561 ms) is heavy weight
     compared to running generate_uudmap.exe (31 ms) and compiling globals.c
     (483 ms). dmake's algo for doing parallel is poor. On the main parallel
     pass with all the mini core .c files compiling ("MINI_OBJ"),
     only generate_uudmap.o will be generated as part of the chain of deps
     hanging off globals.o, after the 1st tier of MINI_OBJ has compiled in
     parallel, dmake will do another sweep of MINI_OBJ, this time it will find
     generate_uudmap.exe node and run linking, at this 2nd tier nothing ran
     except linking generate_uudmap. No parallel anything. This is a
     chokepoint. Then dmake does a 3rd sweep and runs the 3rd tier, which is
     run generate_uudmap.exe, again nothing parallel happens here. By
     combining compiling and linking in 1 target, the time spent serially
     linking generate_uudmap.exe, is moved into parallel time when the rest of
     MINI_OBJ compiles. Also a little bit of CPU and IO is saved by launching
     less processes (less cmd.exe shells, gcc/g++ process ran only once
     (gcc/g++ still run many standalone procs internally but now only 1 gcc
     was started not 2)).
    
    -suppress warnings from dmake with .UPDATEALL, the 3 generated headers
     are made at the same time in real life, in the makefile it was written
     as if they weren't
    dmake: Warning:--Found file corresponding to virtual target [..\uudmap.h].
    dmake: Warning:--Found file corresponding to virtual target [..\mg_data.h].
    
    -move generating the headers to the target that generates
     generate_uudmap.exe, this moves some serialization time, albeit small
     (30 ms) from right before miniperl link, to parallel time during 1st
     pass of MINI_OBJ
    
    -collapse 3 shell runs of xcopy into 1 run of shell
    
    "timeit cmd /c "cmd /c xcopy /f /r /i /d /y ..\perl.exe ..\t\ && cmd /c
    xcopy /f /r /i /d /y ..\perl523.dll ..\t\
    && cmd /c xcopy /f /r /i /d /y ..\perlglob.exe ..\t\"" takes 140 ms
    
    "timeit cmd /c "xcopy /f /r /i /d /y ..\perl.exe ..\t\
    && xcopy /f /r /i /d /y ..\perl523.dll ..\t\
    && xcopy /f /r /i /d /y ..\perlglob.exe ..\t\"" takes 78 ms on my machine

M       win32/makefile.mk

commit d89ea36076afa0a17a3faa7cb33a1c9c215a26eb
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Sat Aug 15 05:24:06 2015 -0400

    add parallel support 4 Win32 dmake-COREDIR parallelism part 2
    
    -defer the mass copy of headers to COREDIR until XS build time
     and dont use COREDIR for building miniperl interp or perl interp, more
     thing to do in parallel this way and 1 less path to search by the CC
    -config_h.PL requires config.h to be in COREDIR, this XCOPY in CONFIGPM
     targ is where COREDIR is created if it doesnt exist already
    -remove a bunch of XCOPY'es, copy the headers in 1 place only, and dont
     copy them unless they change based on timestamps
    -the DYNALOADER dep already contains
     "..\make_ext.pl ..\lib\buildcustomize.pl $(CONFIGPM) $(HAVE_COREDIR)" dont
     specify them again in Extensions and Extensions_reonly, this probably
     reduces the size of dep graph in dmake, since dmake explodes the graph and
     checks the outline of the graph/tree very inefficiently in parallel mode
     (architectural problem with dmake)
    -delete pdb files in root, otherwise switching VC version will make the
     next cl.exe error out that it can't write to the pdb file due to version
     numbers in the pdb file
    -reorder core .c files in a blend of VC and GCC time order, this reduces
     a 1:08 mins time to do "dmake -P9 ../perl522.dll" to 0:54 mins on 8 core
     with GCC, see details in #123867

M       pod/perldelta.pod
M       win32/makefile.mk

commit 3bdc51af3f9be1ab22a176fefca16c329755b094
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Sat Aug 15 16:03:49 2015 -0400

    add parallel support 4 Win32 dmake building part 1
    
    -if building a 32 bit Perl, with a 64bit dmake, force
     PROCESSOR_ARCHITECTURE to x86, otherwise the next couple macros will
     try to build a 64 bit perl with 32 bit CCs
    -PDBOUT is required to run multiple VC cl.exe processes, otherwise all
     VC cl.exe processes will error out trying to lock and write to a
     file called "vc*0.pdb", PDBOUT is empty for GCC builds since they dont
     have PDB files
    -to reduce excess IO calls checking for miniperl.exe plus remove a
     "Found file corresponding to virtual target" warning that dmake emits,
     make this makefile unaware that miniperl.exe exists. dmake has a very bad
     exponential number of IO/stat() calls for every target that is yet
     unbuilt, see procmon logs in [perl #123854], so instead of a stat on
     ../miniperl.exe, then ../lib/buildcustomize.pl, it will be just a stat on
     ../lib/buildcustomize.pl
    -remove makefile awareness of ..\lib\Config_heavy.pl,
     if ..\lib\Config_heavy.pl is ever updated, so is ..\lib\Config.pm
     less IO calls for dmake, see also commit 962e59f394
    -to break up the sequential nature of this makefile, allow (XS) Extensions
     to build, before (AKA parallel with) perl5**.dll and perl.exe are built.
     This is achieved by running makedef.pl very early, and generating
     perl5**.lib/libperl5**.a from the def file, and NOT generating
     perl5**.lib/libperl5**.a from perl5**.dll at link time of perl5**.dll.
     The conquence of this is, declspec(dllexport) is now unusable, but exports
     should be centrally managed anyways (embed.fnc/etc) so this isn't a big
     issue.
    -EUMM makefiles shouldn't be subject to parallelism, untested and disable
     for now, plus creating PLMAKE allows "dmake -n" to work for diagnosing
     this makefile
    -slim down all target. Extensions* and UNIDATAFILES now know how to build
     themselves, the parallel nature says you can't rely on left to right
     execution of deps in a parent node to make a child (dep) node build
    -miniperl.exe used to be unbuildable from a clean tree except from all
     target, since miniperl.exe didn't depend on mini config.h. Also mini dir
     can't be a target, since each .obj built will dirty the mini dir's time
     stamp and infinite loop happens, instead use a .exists file
    -dmake rescans for all outstanding targets, at each recipe line to run,
     this early in the build process, there are an enormous amount of files to
     test for, so the echos are very slow, 350ms each, so combine as many of
     the lines of mini/.exists AKA mini config.h together as possible.  ".IF"
     can't be put inside "one line", so not all lines were merged. Shell "if"
     could be used to further group the echos but this enough to make the pause
     /cpu spining not really noticable. USE_CPLUSPLUS contains an unrolled line
     (the #endif) on both sides. See also procmon logs in [perl #123854]
    -perllib.obj/.o needs perllibst.h which is built by miniperl+a script,
     perllibst.h target doesn't need any Extensions*, so perllib.obj is still
     quick to build
    -perldll.def doesn't need perllibst.h since makedef.pl uses
     $Config{static_ext} to find boot xsubs to export, makedef.pl does not
     read perllibst.h, remove perllibst.h for more parallelism/less things to
     build before perldll.def runs, and therefore Extensions (XS) starts to
     run quicker, and Extensions (XS) is the longest target to build
    -perlmain and perlmainst .obj/.o needs full perl headers to compile, they
     aren't like generate_uudmap.exe and perlglob.exe which are perlapi unaware
    -perl.exe doesn't need perl5**.dll to build, just the imp lib to
     perl5**.dll, perl.exe is in the same category as XS modules, more
     parallelism
    -ppport.h isn't needed in blead perl, since blead is the newest perl in the
     world, this allows Extensions (XS) to run sooner, ppport.h is replaced by
     a dummy empty file, delete ppport.h from final installed CORE dir during
     installation so the dummy ppport.h doesn't wind up in installed perl and 
isnt
     seen by CPAN XS modules during their building by the perl user after perl
     was build and installed, note mkppport script and mkppport.lst are unused
     in makefile.mk now
    -break up the dependencies of all the Extensions* targets, static
     (just Win32CORE normally), dynamic XS and non-XS, these 3 run in parallel
     now, non-XS doesn't need perl5**.lib/.a or any C headers, just PP
     Config.pm
    -DLL XS requires PP DynaLoader.pm for dl_findfile() otherwise
     Mkbootstrap.pm fatally errors, Mkbootstrap.pm could be revised to not load
     DynaLoader on Win32, since "    if ($Config{'dlsrc'} =~ /^dl_dld/){" is
     false, but this is the easier path right now
    -DynaLoader requires module lib to build itself, but Extensions_nonxs
     happens to not need mod lib, so move where mod lib is built
    -in utils target, change it so it can run with miniperl, more parallelism,
     pl2bat doesn't require full perl, the full perl stuff is from
     commit 3fe9a6f19e from 5.003 and no ML archive is available to explain why
     full perl was used instead of mini perl
    
    -add 4 modules to buildcustomize so nonxs and xs build simultaneously
    
    -remove ancient cruft from commit 26618a56da from 1997 from README.w32
     dmake is automatically set inside CFG_VARS today. OSRELEASE is irrelavent
     today, Perl doesn't use any of the defaults (like name of CC) from the
     maketool.
    
    -Reduce 21 calls of "cmd.exe /x/d/c cd" by miniperl to just 1 by saving and
     reusing cwd. This reduced the amount of time to run
     "..\miniperl.exe -I..\lib -f ..\write_buildcustomize.pl .." from 312 ms
     to 62 ms elapsed time using timeit.exe for me.

M       README.win32
M       mkppport
M       win32/makefile.mk
M       write_buildcustomize.pl
-----------------------------------------------------------------------

Summary of changes:
 README.win32            |  27 ++-
 mkppport                |   3 +-
 pod/perldelta.pod       |  11 +
 win32/makefile.mk       | 575 ++++++++++++++++++++++++++----------------------
 write_buildcustomize.pl |  17 +-
 5 files changed, 353 insertions(+), 280 deletions(-)

diff --git a/README.win32 b/README.win32
index d6c50d7..f78f113 100644
--- a/README.win32
+++ b/README.win32
@@ -96,11 +96,16 @@ See L<Usage Hints for Perl on Windows> below for general 
hints about this.
 =item Make
 
 You need a "make" program to build the sources.  If you are using
-Visual C++ or the Windows SDK tools, nmake will work.  Builds using
-the gcc need dmake.
-
-dmake is a freely available make that has very nice macro features
-and parallelability.
+Visual C++ or the Windows SDK tools, you can use nmake supplied with Visual C++
+or Windows SDK. You may also use, for Visual C++ or Windows SDK, dmake instead
+of nmake.  dmake is open source software, but is not included with Visual C++ 
or
+Windows SDK.  If you want parallel building with Visual C++ or
+Windows SDK you must use dmake instead of nmake.  Builds using gcc need dmake.
+nmake is not supported for gcc builds.  gmake is not supported, but might be
+added in the future.  It is recommended to use dmake 4.13 or newer for parallel
+building.  Older dmakes, in parallel mode, have very high CPU usage and pound
+the disk/filing system with duplicate I/O calls in an aggressive polling
+loop.
 
 A port of dmake for Windows is available from:
 
@@ -135,13 +140,6 @@ console already set up for your target architecture 
(x86-32 or x86-64 or IA64).
 With the newer compilers, you may also use the older batch files if you choose
 so.
 
-You can also use dmake to build using Visual C++; provided, however,
-you set OSRELEASE to "microsft" (or whatever the directory name
-under which the Visual C dmake configuration lives) in your environment
-and edit win32/config.vc to change "make=nmake" into "make=dmake".  The
-latter step is only essential if you want to use dmake as your default
-make for building extensions using MakeMaker.
-
 =item Microsoft Visual C++ 2008-2013 Express Edition
 
 These free versions of Visual C++ 2008-2013 Professional contain the same
@@ -400,6 +398,11 @@ perl523.dll at the perl toplevel, and various other 
extension dll's
 under the lib\auto directory.  If the build fails for any reason, make
 sure you have done the previous steps correctly.
 
+To try dmake's parallel mode, type "dmake -P2", where 2, is the maximum number
+of parallel jobs you want to run. A number of things in the build process will
+run in parallel, but there are serialization points where you will see just 1
+CPU maxed out. This is normal.
+
 If you are advanced enough with building C code, here is a suggestion to speed
 up building perl, and the later C<make test>. Try to keep your PATH 
enviromental
 variable with the least number of folders possible (remember to keep your C
diff --git a/mkppport b/mkppport
index 55a74fa..9f4fd75 100644
--- a/mkppport
+++ b/mkppport
@@ -160,7 +160,8 @@ mkppport [B<--list>=I<file>] [B<--clean>]
 
 B<mkppport> generates a I<ppport.h> file using Devel::PPPort
 and distributes it to the various extension directories that
-need it to build.
+need it to build.  On certain Win32 builds, this script is not
+used and an alternative mechanism is used to create I<ppport.h>.
 
 =head1 OPTIONS
 
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 7ce0d38..e4389c3 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -320,6 +320,17 @@ Comparing two strings that were both encoded in UTF-8 (or 
more
 precisely, UTF-EBCDIC) did not work properly until now.  Since C<sort()>
 uses C<cmp()>, this fixes that as well.
 
+=item Win32
+
+=over
+
+=item *
+
+Parallel building has been added to the dmake C<makefile.mk> makefile. All
+Win32 compilers are supported.
+
+=back
+
 =back
 
 =head1 Internal Changes
diff --git a/win32/makefile.mk b/win32/makefile.mk
index eb867e1..2749d6b 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -345,6 +345,10 @@ BUILDOPT   += -DPERL_IMPLICIT_SYS
 
 PROCESSOR_ARCHITECTURE *= x86
 
+.IF "$(WIN64)" == "undef"
+PROCESSOR_ARCHITECTURE = x86
+.ENDIF
+
 .IF "$(WIN64)" == ""
 # When we are running from a 32bit cmd.exe on AMD64 then
 # PROCESSOR_ARCHITECTURE is set to x86 and PROCESSOR_ARCHITEW6432
@@ -468,7 +472,7 @@ a = .a
 # Options
 #
 
-INCLUDES       = -I.\include -I. -I.. -I$(COREDIR)
+INCLUDES       = -I.\include -I. -I..
 DEFINES                = -DWIN32
 .IF "$(WIN64)" == "define"
 DEFINES                += -DWIN64 -DCONSERVATIVE
@@ -508,6 +512,7 @@ LINK_FLAGS  = $(LINK_DBG) -L"$(INST_COREDIR)" 
-L"$(CCLIBDIR)"
 OBJOUT_FLAG    = -o
 EXEOUT_FLAG    = -o
 LIBOUT_FLAG    =
+PDBOUT         =
 
 BUILDOPT       += -fno-strict-aliasing -mms-bitfields
 MINIBUILDOPT   += -fno-strict-aliasing
@@ -555,7 +560,7 @@ RSC         = rc
 # Options
 #
 
-INCLUDES       = -I$(COREDIR) -I.\include -I. -I..
+INCLUDES       = -I.\include -I. -I..
 #PCHFLAGS      = -Fpc:\temp\vcmoduls.pch -YX
 DEFINES                = -DWIN32 -D_CONSOLE -DNO_STRICT
 LOCDEFS                = -DPERLDLL -DPERL_CORE
@@ -653,11 +658,11 @@ CFLAGS            = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) 
$(LOCDEFS) \
 LINK_FLAGS     = -nologo -nodefaultlib $(LINK_DBG) \
                -libpath:"$(INST_COREDIR)" \
                -machine:$(PROCESSOR_ARCHITECTURE)
-LIB_FLAGS      = $(LIB_FLAGS) -nologo
+LIB_FLAGS      += -nologo
 OBJOUT_FLAG    = -Fo
 EXEOUT_FLAG    = -Fe
 LIBOUT_FLAG    = /out:
-
+PDBOUT         = -Fd$*.pdb
 TESTPREPGCC    =
 
 .ENDIF
@@ -717,7 +722,7 @@ LKPOST              = )
 .SUFFIXES : .c .i $(o) .dll $(a) .exe .rc .res
 
 .c$(o):
-       $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
+       $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ 
$(PDBOUT) $<
 
 .c.i:
        $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) -E $< >$@
@@ -744,14 +749,19 @@ $(o).dll:
 
 #
 # various targets
+
+#do not put $(MINIPERL) as a dep/prereq in a rule, instead put $(HAVEMINIPERL)
+#$(MINIPERL) is not a buildable target, use "dmake mp" if you want to just 
build
+#miniperl alone
 MINIPERL       = ..\miniperl.exe
+HAVEMINIPERL   = ..\lib\buildcustomize.pl
 MINIDIR                = .\mini
 PERLEXE                = ..\perl.exe
 WPERLEXE       = ..\wperl.exe
 PERLEXESTATIC  = ..\perl-static.exe
 STATICDIR      = .\static.tmp
 GLOBEXE                = ..\perlglob.exe
-CONFIGPM       = ..\lib\Config.pm ..\lib\Config_heavy.pl
+CONFIGPM       = ..\lib\Config.pm
 GENUUDMAP      = ..\generate_uudmap.exe
 .IF "$(BUILD_STATIC)" == "define" || "$(ALL_STATIC)" == "define"
 PERLSTATIC     = static
@@ -778,7 +788,7 @@ PERLDLL_RES =
 # This used to be $(PERLEXE), but at worst it is the .dll that they depend
 # on and really only the interface - i.e. the .def file used to export symbols
 # from the .dll
-PERLDEP = perldll.def
+PERLDEP = $(PERLIMPLIB)
 
 
 PL2BAT         = bin\pl2bat.pl
@@ -834,52 +844,66 @@ INT64             = __int64
 # 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     *= ..\perl523$(a)
+PERLEXPLIB     *= ..\perl523.exp
 PERLSTATICLIB  *= ..\perl523s$(a)
 PERLDLL                = ..\perl523.dll
 
+#EUMM on Win32 isn't ready for parallel make, so only allow this file to be 
parallel
+#$(MAKE) will contain the -P that this makefile was called with, which is bad 
for
+#make_ext.pl since upto jobs*jobs processes will run instead of jobs
+#also any recipie containing $(MAKE) is special cased by dmake to execute 
recipes
+#containing $(MAKE) when "dmake -n" is executed, which causes recursive calls
+#to dmake, which means "dmake -n" is then broken as a diagnostic tool since
+#"dmake -n" will invoke all the make_ext.pl scripts build things instead of
+#showing what to build since $(MAKE) is an arg to make_ext.pl, not an 
invocation
+#of the dmake process
+PLMAKE         = dmake
+
 XCOPY          = xcopy /f /r /i /d /y
 RCOPY          = xcopy /f /r /i /e /d /y
 NOOP           = @rem
 
+#first ones are arrange in compile time order for faster parallel building
+#see #123867 for details
 MICROCORE_SRC  =               \
+               ..\toke.c       \
+               ..\regcomp.c    \
+               ..\regexec.c    \
+               ..\op.c         \
+               ..\sv.c         \
+               ..\pp.c         \
+               ..\pp_ctl.c     \
+               ..\pp_sys.c     \
+               ..\pp_pack.c    \
+               ..\pp_hot.c     \
+               ..\gv.c         \
+               ..\perl.c       \
+               ..\utf8.c       \
+               ..\dump.c       \
+               ..\hv.c         \
                ..\av.c         \
                ..\caretx.c     \
                ..\deb.c        \
                ..\doio.c       \
                ..\doop.c       \
                ..\dquote.c     \
-               ..\dump.c       \
                ..\globals.c    \
-               ..\gv.c         \
                ..\mro_core.c   \
-               ..\hv.c         \
                ..\locale.c     \
                ..\keywords.c   \
                ..\mathoms.c    \
                ..\mg.c         \
                ..\numeric.c    \
-               ..\op.c         \
                ..\pad.c        \
-               ..\perl.c       \
                ..\perlapi.c    \
                ..\perly.c      \
-               ..\pp.c         \
-               ..\pp_ctl.c     \
-               ..\pp_hot.c     \
-               ..\pp_pack.c    \
                ..\pp_sort.c    \
-               ..\pp_sys.c     \
                ..\reentr.c     \
-               ..\regcomp.c    \
-               ..\regexec.c    \
                ..\run.c        \
                ..\scope.c      \
-               ..\sv.c         \
                ..\taint.c      \
                ..\time64.c     \
-               ..\toke.c       \
                ..\universal.c  \
-               ..\utf8.c       \
                ..\util.c
 
 EXTRACORE_SRC  += perllib.c
@@ -944,6 +968,10 @@ UUDMAP_H   = ..\uudmap.h
 BITCOUNT_H     = ..\bitcount.h
 MG_DATA_H      = ..\mg_data.h
 GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)
+#a stub ppport.h must be generated so building XS modules, .c->.obj wise, will
+#work, so this target also represents creating the COREDIR and filling it
+HAVE_COREDIR   = $(COREDIR)\ppport.h
+
 
 MICROCORE_OBJ  = $(MICROCORE_SRC:db:+$(o))
 CORE_OBJ       = $(MICROCORE_OBJ) $(EXTRACORE_SRC:db:+$(o))
@@ -952,7 +980,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)
-GENUUDMAP_OBJ  = $(GENUUDMAP:db:+$(o))
 
 PERLDLL_OBJ    = $(CORE_OBJ)
 PERLEXE_OBJ    = perlmain$(o)
@@ -997,7 +1024,7 @@ CFG_VARS   =                                       \
                libperl=$(PERLIMPLIB:f)         ~       \
                libpth=$(CCLIBDIR);$(EXTRALIBDIRS)      ~       \
                libc=$(LIBC)                    ~       \
-               make=dmake                      ~       \
+               make=$(PLMAKE)                  ~       \
                _o=$(o)                         ~       \
                obj_ext=$(o)                    ~       \
                _a=$(a)                         ~       \
@@ -1019,9 +1046,7 @@ CFG_VARS  =                                       \
 # Top targets
 #
 
-all : CHECKDMAKE .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL)    \
-       $(CONFIGPM) $(UNIDATAFILES) MakePPPort                          \
-       $(PERLEXE) Extensions Extensions_nonxs $(PERLSTATIC)
+all : CHECKDMAKE  rebasePE $(UNIDATAFILES) Extensions_nonxs $(PERLSTATIC)
 
 regnodes : ..\regnodes.h
 
@@ -1059,178 +1084,13 @@ perlglob$(o)  : perlglob.c
 config.w32 : $(CFGSH_TMPL)
        copy $(CFGSH_TMPL) config.w32
 
-#
-# Copy the template config.h and set configurables at the end of it
-# as per the options chosen and compiler used.
-# Note: This config.h is only used to build miniperl.exe anyway, but
-# it's as well to have its options correct to be sure that it builds
-# and so that it's "-V" options are correct for use by makedef.pl. The
-# real config.h used to build perl.exe is generated from the top-level
-# config_h.SH by config_h.PL (run by miniperl.exe).
-#
-.\config.h : $(CFGH_TMPL) $(CORE_NOCFG_H)
-       -del /f config.h
-       copy $(CFGH_TMPL) config.h
-       @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>>$@
-       @echo #undef UVSIZE>>$@
-       @echo #undef NV_PRESERVES_UV>>$@
-       @echo #undef NV_PRESERVES_UV_BITS>>$@
-       @echo #undef IVdf>>$@
-       @echo #undef UVuf>>$@
-       @echo #undef UVof>>$@
-       @echo #undef UVxf>>$@
-       @echo #undef UVXf>>$@
-       @echo #undef USE_64_BIT_INT>>$@
-       @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)>>$@
-       @echo #define HAS_ATOLL>>$@
-       @echo #define HAS_STRTOLL>>$@
-       @echo #define HAS_STRTOULL>>$@
-       @echo #define Size_t_size ^8>>$@
-.ELSE
-       @echo #define PTRSIZE ^4>>$@
-       @echo #define SSize_t int>>$@
-       @echo #undef HAS_ATOLL>>$@
-       @echo #undef HAS_STRTOLL>>$@
-       @echo #undef HAS_STRTOULL>>$@
-       @echo #define Size_t_size ^4>>$@
-.ENDIF
-.IF "$(USE_64_BIT_INT)"=="define"
-       @echo #define IVTYPE $(INT64)>>$@
-       @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>>$@
-.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>>$@
-       @echo #define UVTYPE unsigned long>>$@
-       @echo #define IVSIZE ^4>>$@
-       @echo #define UVSIZE ^4>>$@
-       @echo #define NV_PRESERVES_UV>>$@
-       @echo #define NV_PRESERVES_UV_BITS 32>>$@
-       @echo #define IVdf "ld">>$@
-       @echo #define UVuf "lu">>$@
-       @echo #define UVof "lo">>$@
-       @echo #define UVxf "lx">>$@
-       @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
+..\git_version.h : $(HAVEMINIPERL) ..\make_patchnum.pl
        cd .. && miniperl -Ilib make_patchnum.pl
 
 # make sure that we recompile perl.c if the git version changes
 ..\perl$(o) : ..\git_version.h
 
-..\config.sh : config.w32 $(MINIPERL) config_sh.PL FindExt.pm
+..\config.sh : config.w32 $(HAVEMINIPERL) config_sh.PL FindExt.pm
        $(MINIPERL) -I..\lib config_sh.PL --cfgsh-option-file \
            $(mktmp $(CFG_VARS)) config.w32 > ..\config.sh
 
@@ -1246,18 +1106,15 @@ regen_config_h:
        -$(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)"
        rename config.h $(CFGH_TMPL)
 
-$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL
+$(CONFIGPM): ..\config.sh config_h.PL
        $(MINIPERL) -I..\lib ..\configpm --chdir=..
-       $(XCOPY) ..\*.h $(COREDIR)\*.*
-       $(XCOPY) *.h $(COREDIR)\*.*
-       $(RCOPY) include $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)" \
-           || $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)
+       $(XCOPY) config.h $(COREDIR)\*.*
+       -$(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)"
 
-# See the comment in Makefile.SH explaining this seemingly cranky ordering
-$(MINIPERL) : ..\lib\buildcustomize.pl
+.\config.h : $(CONFIGPM)
 
-..\lib\buildcustomize.pl : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS) 
..\write_buildcustomize.pl
+# See the comment in Makefile.SH explaining this seemingly cranky ordering
+..\lib\buildcustomize.pl : $(MINI_OBJ) ..\write_buildcustomize.pl
 .IF "$(CCTYPE)" == "GCC"
        $(LINK32) -v -mconsole -o $(MINIPERL) $(BLINK_FLAGS) \
            $(mktmp $(LKPRE) $(MINI_OBJ) $(LIBFILES) $(LKPOST))
@@ -1268,31 +1125,202 @@ $(MINIPERL) : ..\lib\buildcustomize.pl
 .ENDIF
        $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl ..
 
-$(MINIDIR) :
+#convinence target, get a working miniperl
+mp : $(CONFIGPM)
+
+$(MINIDIR)\.exists : $(CFGH_TMPL)
        if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
+#
+# Copy the template config.h and set configurables at the end of it
+# as per the options chosen and compiler used.
+# Note: This config.h is only used to build miniperl.exe anyway, but
+# it's as well to have its options correct to be sure that it builds
+# and so that it's "-V" options are correct for use by makedef.pl. The
+# real config.h used to build perl.exe is generated from the top-level
+# config_h.SH by config_h.PL (run by miniperl.exe).
+#
+# MINIDIR generates config.h so miniperl.exe is not rebuilt when the 2nd
+# config.h is generated in CONFIGPM target, see also the comments for 
$(MINI_OBJ).
+       -if exist config.h del /f config.h
+       copy $(CFGH_TMPL) config.h
+       @(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&& \
+       echo #undef UVSIZE&& \
+       echo #undef NV_PRESERVES_UV&& \
+       echo #undef NV_PRESERVES_UV_BITS&& \
+       echo #undef IVdf&& \
+       echo #undef UVuf&& \
+       echo #undef UVof&& \
+       echo #undef UVxf&& \
+       echo #undef UVXf&& \
+       echo #undef USE_64_BIT_INT&& \
+       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)>> config.h
+.IF "$(USE_LARGE_FILES)"=="define"
+       @(echo #define Off_t $(INT64)&& \
+       echo #define LSEEKSIZE ^8&& \
+       echo #define Off_t_size ^8)>> config.h
+.ELSE
+       @(echo #define Off_t long&& \
+       echo #define LSEEKSIZE ^4&& \
+       echo #define Off_t_size ^4)>> config.h
+.ENDIF
+.IF "$(WIN64)"=="define"
+       @(echo #define PTRSIZE ^8&& \
+       echo #define SSize_t $(INT64)&& \
+       echo #define HAS_ATOLL&& \
+       echo #define HAS_STRTOLL&& \
+       echo #define HAS_STRTOULL&& \
+       echo #define Size_t_size ^8)>> config.h
+.ELSE
+       @(echo #define PTRSIZE ^4&& \
+       echo #define SSize_t int&& \
+       echo #undef HAS_ATOLL&& \
+       echo #undef HAS_STRTOLL&& \
+       echo #undef HAS_STRTOULL&& \
+       echo #define Size_t_size ^4)>> config.h
+.ENDIF
+.IF "$(USE_64_BIT_INT)"=="define"
+       @(echo #define IVTYPE $(INT64)&& \
+       echo #define UVTYPE unsigned $(INT64)&& \
+       echo #define IVSIZE ^8&& \
+       echo #define UVSIZE ^8)>> config.h
+.IF "$(USE_LONG_DOUBLE)"=="define"
+       @(echo #define NV_PRESERVES_UV&& \
+       echo #define NV_PRESERVES_UV_BITS 64)>> config.h
+.ELSE
+       @(echo #undef NV_PRESERVES_UV&& \
+       echo #define NV_PRESERVES_UV_BITS 53)>> config.h
+.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)>> config.h
+.ELSE
+       @(echo #define IVTYPE long&& \
+       echo #define UVTYPE unsigned long&& \
+       echo #define IVSIZE ^4&& \
+       echo #define UVSIZE ^4&& \
+       echo #define NV_PRESERVES_UV&& \
+       echo #define NV_PRESERVES_UV_BITS 32&& \
+       echo #define IVdf "ld"&& \
+       echo #define UVuf "lu"&& \
+       echo #define UVof "lo"&& \
+       echo #define UVxf "lx"&& \
+       echo #define UVXf "lX"&& \
+       echo #undef USE_64_BIT_INT)>> config.h
+.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)>> config.h
+.IF "$(WIN64)"=="define"
+       @(echo #define NVSIZE ^16&& \
+       echo #define LONG_DOUBLESIZE ^16)>> config.h
+.ELSE
+       @(echo #define NVSIZE ^12&& \
+       echo #define LONG_DOUBLESIZE ^12)>> config.h
+.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)>> config.h
+.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)>> config.h
+.ENDIF
+.IF "$(USE_CPLUSPLUS)"=="define"
+       @(echo #define USE_CPLUSPLUS&& \
+       echo #endif)>> config.h
+.ELSE
+       @(echo #undef USE_CPLUSPLUS&& \
+       echo #endif)>> config.h
+.ENDIF
+#separate line since this is sentinal that this target is done
+       rem. > $(MINIDIR)\.exists
 
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-       $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB 
-DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
+       $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB 
-DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) ..\$(*B).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-       $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ 
$(*B).c
+       $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ 
$(PDBOUT) $(*B).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
 # unless the .IF is true), so instead we use a .ELSE with the default.
 # This is the only file that depends on perlhost.h, vmem.h, and vdir.h
 
-perllib$(o)    : perllib.c .\perlhost.h .\vdir.h .\vmem.h
+perllib$(o)    : perllib.c perllibst.h .\perlhost.h .\vdir.h .\vmem.h
 .IF "$(USE_IMP_SYS)" == "define"
-       $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
+       $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ $(PDBOUT) 
perllib.c
 .ELSE
-       $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ perllib.c
+       $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ $(PDBOUT) perllib.c
 .ENDIF
 
 # 1. we don't want to rebuild miniperl.exe when config.h changes
 # 2. we don't want to rebuild miniperl.exe with non-default config.h
 # 3. we can't have miniperl.exe depend on git_version.h, as miniperl creates it
-$(MINI_OBJ)    : $(CORE_NOCFG_H)
+$(MINI_OBJ)    : $(MINIDIR)\.exists $(CORE_NOCFG_H)
 
 $(WIN32_OBJ)   : $(CORE_H)
 
@@ -1300,12 +1328,26 @@ $(CORE_OBJ)     : $(CORE_H)
 
 $(DLL_OBJ)     : $(CORE_H)
 
-perldll.def : $(MINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl 
create_perllibst_h.pl
+
+perllibst.h : $(HAVEMINIPERL) $(CONFIGPM) create_perllibst_h.pl
        $(MINIPERL) -I..\lib create_perllibst_h.pl
+
+perldll.def : $(HAVEMINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl
        $(MINIPERL) -I..\lib -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) 
$(DEFINES) \
        $(BUILDOPT) CCTYPE=$(CCTYPE) TARG_DIR=..\ > perldll.def
 
-$(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
+$(PERLIMPLIB) : perldll.def
+.IF "$(CCTYPE)" == "GCC"
+       $(IMPLIB) -k -d perldll.def -l $(PERLIMPLIB)
+.ELSE #VC family
+       lib -def:perldll.def -machine:$(ARCHITECTURE) /OUT:$(PERLIMPLIB)
+.ENDIF
+       $(XCOPY) $(PERLIMPLIB) $(COREDIR)
+
+#PERLEXPLIB is built in PERLIMPLIB
+$(PERLEXPLIB): $(PERLIMPLIB)
+
+$(PERLDLL): $(PERLEXPLIB) $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
 .IF "$(CCTYPE)" == "GCC"
        $(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(BLINK_FLAGS) \
            $(mktmp $(LKPRE) $(PERLDLL_OBJ) \
@@ -1321,13 +1363,12 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) 
Extensions_static
                $(shell @type Extensions_static) \
                $(LIBFILES) perl.exp $(LKPOST))
 .ELSE
-       $(LINK32) -dll -def:perldll.def -out:$@ $(BLINK_FLAGS) \
+       $(LINK32) -dll -out:$@ $(BLINK_FLAGS) \
            @Extensions_static \
            @$(mktmp -base:0x28000000 $(DELAYLOAD) $(LIBFILES) \
-               $(PERLDLL_RES) $(PERLDLL_OBJ))
+               $(PERLDLL_RES) $(PERLDLL_OBJ) $(PERLEXPLIB))
        $(EMBED_DLL_MANI)
 .ENDIF
-       $(XCOPY) $(PERLIMPLIB) $(COREDIR)
 
 $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
 .IF "$(CCTYPE)" == "GCC"
@@ -1342,41 +1383,42 @@ $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
        $(LIB32) $(LIB_FLAGS) -out:$@ @Extensions_static \
            @$(mktmp $(PERLDLL_OBJ))
 .ENDIF
-       $(XCOPY) $(PERLSTATICLIB) $(COREDIR)
+       $(XCOPY) $(PERLSTATICLIB) $(COREDIR)\$(NULL)
 
 $(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
 
 $(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
 
-$(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
-
-$(BITCOUNT_H) : $(GENUUDMAP)
-       $(GENUUDMAP) $(GENERATED_HEADERS)
-
-$(GENUUDMAP_OBJ) : ..\mg_raw.h
-
-$(GENUUDMAP) : $(GENUUDMAP_OBJ)
+$(GENUUDMAP) $(GENERATED_HEADERS) .UPDATEALL : ..\mg_raw.h
 .IF "$(CCTYPE)" == "GCC"
-       $(LINK32) -v -o $@ $(BLINK_FLAGS) \
-           $(mktmp $(LKPRE) $(GENUUDMAP_OBJ) $(LIBFILES) $(LKPOST))
+       $(LINK32) $(CFLAGS_O) -o..\generate_uudmap.exe ..\generate_uudmap.c 
$(BLINK_FLAGS) \
+           $(mktmp $(LKPRE) $(LIBFILES) $(LKPOST))
 .ELSE
-       $(LINK32) -out:$@ $(BLINK_FLAGS) @$(mktmp $(LIBFILES) $(GENUUDMAP_OBJ))
-       $(EMBED_EXE_MANI)
+       $(CC) $(CFLAGS_O) -Fe..\generate_uudmap.exe ..\generate_uudmap.c 
@$(mktmp -link $(LIBFILES)) -link $(BLINK_FLAGS) 
+       $(EMBED_EXE_MANI:s/$@/..\generate_uudmap.exe/)
 .ENDIF
+       $(GENUUDMAP) $(GENERATED_HEADERS)
+
+#This generates a stub ppport.h & creates & fills /lib/CORE to allow for XS
+#building .c->.obj wise (linking is a different thing). This taget is AKA
+#$(HAVE_COREDIR).
+$(COREDIR)\ppport.h : $(CORE_H)
+       $(XCOPY) *.h $(COREDIR)\*.* && $(RCOPY) include $(COREDIR)\*.* && 
$(XCOPY) ..\*.h $(COREDIR)\*.*
+       rem. > $@
 
 perlmain.c : runperl.c
        copy runperl.c perlmain.c
 
-perlmain$(o) : perlmain.c
-       $(CC) $(CFLAGS_O:s,-DPERLDLL,-UPERLDLL,) $(OBJOUT_FLAG)$@ -c perlmain.c
+perlmain$(o) : $(CONFIGPM) perlmain.c
+       $(CC) $(CFLAGS_O:s,-DPERLDLL,-UPERLDLL,) $(OBJOUT_FLAG)$@ $(PDBOUT) -c 
perlmain.c
 
 perlmainst.c : runperl.c
        copy runperl.c perlmainst.c
 
-perlmainst$(o) : perlmainst.c
-       $(CC) $(CFLAGS_O) $(OBJOUT_FLAG)$@ -c perlmainst.c
+perlmainst$(o) : $(CONFIGPM) perlmainst.c
+       $(CC) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $(PDBOUT) -c perlmainst.c
 
-$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
+$(PERLEXE): $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB)
 .IF "$(CCTYPE)" == "GCC"
        $(LINK32) -mconsole -o $@ $(BLINK_FLAGS)  \
            $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB) $(LIBFILES)
@@ -1398,43 +1440,48 @@ $(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) 
$(PERLEXEST_OBJ) $(PERLEXE_RES)
        $(EMBED_EXE_MANI)
 .ENDIF
 
-MakePPPort: $(MINIPERL) $(CONFIGPM) Extensions_nonxs
-       $(MINIPERL) -I..\lib ..\mkppport
-
 
#-------------------------------------------------------------------------------
 # There's no direct way to mark a dependency on
 # DynaLoader.pm, so this will have to do
-Extensions : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) 
$(DYNALOADER)
-       $(XCOPY) ..\*.h $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic
 
-Extensions_reonly : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) 
$(CONFIGPM) $(DYNALOADER)
-       $(XCOPY) ..\*.h $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
+#most of deps of this target are in DYNALOADER and therefore omitted here
+Extensions : $(PERLDEP) $(DYNALOADER)
+       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic
+
+Extensions_reonly : $(PERLDEP) $(DYNALOADER)
+       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
 
-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
+Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl 
list_static_libs.pl $(CONFIGPM) $(HAVE_COREDIR)
+       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --static
        $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
 
-Extensions_nonxs : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) 
$(CONFIGPM) ..\pod\perlfunc.pod
-       $(XCOPY) ..\*.h $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs
+Extensions_nonxs : ..\make_ext.pl ..\lib\buildcustomize.pl $(CONFIGPM) 
..\pod\perlfunc.pod
+       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) 
--dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs !libs
 
-$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) 
Extensions_nonxs
-       $(XCOPY) ..\*.h $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) 
--dynaloader
+#lib must be built, it can't be buildcustomize.pl-ed, and is required for XS 
building
+$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(CONFIGPM) 
$(HAVE_COREDIR)
+       $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(EXTDIR) 
--dir=$(DISTDIR) --dynaloader lib
 
 Extensions_clean :
-       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl 
"MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all 
--target=clean
+       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl 
"MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all 
--target=clean
 
 Extensions_realclean :
-       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl 
"MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all 
--target=realclean
+       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl 
"MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all 
--target=realclean
+
+# all PE files need to be built by the time this target runs, PP files can 
still
+# be running in parallel like UNIDATAFILES, this target a placeholder for the
+# future
+.IF "$(BUILD_STATIC)"=="define"
+rebasePE : Extensions $(PERLDLL) $(PERLEXE) $(GLOBEXE) $(PERLEXESTATIC)
+.ELSE
+rebasePE : Extensions $(PERLDLL) $(PERLEXE) $(GLOBEXE)
+.ENDIF
+       $(NOOP)
 
 
#-------------------------------------------------------------------------------
 
 
-doc: $(PERLEXE) ..\pod\perltoc.pod
+doc: $(PERLEXE) $(PERLDLL) ..\pod\perltoc.pod
        $(PERLEXE) ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
            --podpath=pod:lib:utils --htmlroot="file://$(INST_HTML:s,:,|,)"\
            --recurse
@@ -1444,8 +1491,8 @@ 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) ..\utils\Makefile
-       cd ..\utils && $(MAKE) PERL=$(MINIPERL)
+utils: $(HAVEMINIPERL) ..\utils\Makefile
+       cd ..\utils && $(PLMAKE) PERL=$(MINIPERL)
        copy ..\README.aix      ..\pod\perlaix.pod
        copy ..\README.amiga    ..\pod\perlamiga.pod
        copy ..\README.android  ..\pod\perlandroid.pod
@@ -1480,11 +1527,11 @@ utils: $(PERLEXE) ..\utils\Makefile
        copy ..\README.vos      ..\pod\perlvos.pod
        copy ..\README.win32    ..\pod\perlwin32.pod
        copy ..\pod\perldelta.pod ..\pod\perl5233delta.pod
-       $(PERLEXE) $(PL2BAT) $(UTILS)
+       $(MINIPERL) -I..\lib $(PL2BAT) $(UTILS)
        $(MINIPERL) -I..\lib ..\autodoc.pl ..
        $(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
 
-..\pod\perltoc.pod: $(PERLEXE) Extensions Extensions_nonxs
+..\pod\perltoc.pod: $(PERLEXE) $(PERLDLL) Extensions Extensions_nonxs 
..\pod\perluniprops.pod utils
        $(PERLEXE) -f ..\pod\buildtoc -q
 
 # Note that the pod cleanup in this next section is parsed (and regenerated
@@ -1610,6 +1657,7 @@ install : all installbare installhtml
 
 installbare : utils ..\pod\perltoc.pod
        $(PERLEXE) ..\installperl
+       attrib -r $(INST_COREDIR)\ppport.h && del $(INST_COREDIR)\ppport.h
        if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\*.*
        if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\*.*
        $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
@@ -1622,11 +1670,11 @@ installhtml : doc
 inst_lib : $(CONFIGPM)
        $(RCOPY) ..\lib $(INST_LIB)\*.*
 
-$(UNIDATAFILES) ..\pod\perluniprops.pod .UPDATEALL : $(MINIPERL) $(CONFIGPM) 
..\lib\unicore\mktables Extensions_nonxs
+$(UNIDATAFILES) ..\pod\perluniprops.pod .UPDATEALL : $(CONFIGPM) 
..\lib\unicore\mktables
        cd ..\lib\unicore && \
        ..\$(MINIPERL) -I.. mktables -P ..\..\pod -maketest -makelist -p
 
-minitest : .\config.h $(MINIPERL) ..\git_version.h $(GLOBEXE) $(CONFIGPM) 
$(UNIDATAFILES) $(TESTPREPGCC)
+minitest : .\config.h $(HAVEMINIPERL) ..\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
@@ -1635,9 +1683,8 @@ minitest : .\config.h $(MINIPERL) ..\git_version.h 
$(GLOBEXE) $(CONFIGPM) $(UNID
        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 $(TESTPREPGCC)
-       $(XCOPY) $(PERLEXE) ..\t\$(NULL)
-       $(XCOPY) $(PERLDLL) ..\t\$(NULL)
-       $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
+       $(XCOPY) $(PERLEXE) ..\t\$(NULL) && $(XCOPY) $(PERLDLL) ..\t\$(NULL) \
+       && $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
 
 # If building with gcc versions 4.x.x or greater, then
 # the GCC helper DLL will also need copied to the test directory.
@@ -1712,7 +1759,7 @@ _clean :
        -@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp *.res
        -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
        -@erase *.ilk
-       -@erase *.pdb
+       -@erase *.pdb ..\*.pdb
        -@erase Extensions_static
 
 
diff --git a/write_buildcustomize.pl b/write_buildcustomize.pl
index 5d819b5..d3bbd0f 100644
--- a/write_buildcustomize.pl
+++ b/write_buildcustomize.pl
@@ -41,12 +41,23 @@ my @toolchain = qw(cpan/AutoLoader/lib
                   dist/constant/lib
                   );
 
-# Used only in ExtUtils::Liblist::Kid::_win32_ext()
-push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32';
+# Text-ParseWords used only in ExtUtils::Liblist::Kid::_win32_ext()
+# the rest are for XS building on Win32, since nonxs and xs build 
simultaneously
+# on Win32 if parallel building
+push @toolchain, qw(
+       cpan/Text-ParseWords/lib
+       dist/ExtUtils-ParseXS/lib
+       cpan/Getopt-Long/lib
+       cpan/parent/lib
+       cpan/ExtUtils-Constant/lib
+) if $^O eq 'MSWin32';
 push @toolchain, 'ext/VMS-Filespec/lib' if $^O eq 'VMS';
 
 unshift @INC, @toolchain;
 require File::Spec::Functions;
+require Cwd;
+
+my $cwd  = Cwd::getcwd();
 
 # lib must be last, as the toolchain modules write themselves into it
 # as they build, and it's important that @INC order ensures that the partially
@@ -54,7 +65,7 @@ require File::Spec::Functions;
 
 my $inc = join ",\n        ",
     map { "q\0$_\0" }
-    (map {File::Spec::Functions::rel2abs($_)} (
+    (map {File::Spec::Functions::rel2abs($_, $cwd)} (
 # faster build on the non-parallel Win32 build process
         $^O eq 'MSWin32' ? ('lib', @toolchain ) : (@toolchain, 'lib')
     ));

--
Perl5 Master Repository

Reply via email to