This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
officially support Visual C++ 2022
[perl5.git] / win32 / GNUmakefile
1 #
2 # Makefile to build perl on Windows using GMAKE.
3 # Supported compilers:
4 #       Microsoft Visual C++ 12.0 or later
5 #       MinGW with gcc-3.4.5-5.3.0
6 #       MinGW64 with gcc-4.4.3 or later
7 #
8 # This is set up to build a perl.exe that runs off a shared library
9 # (perl535.dll).  Also makes individual DLLs for the XS extensions.
10 #
11 # The easiest way to customize the build process is to use parameters like this:
12 #
13 # c:\dev\perlsrc\win32> gmake INST_TOP=c:\sw\perl CCHOME=c:\sw\mingw USE_64_BIT_INT=define
14
15
16 ##
17 ## Make sure you read README.win32 *before* you mess with anything here!
18 ##
19
20 #
21 # We set this to point to cmd.exe in case GNU Make finds sh.exe in the path.
22 # Comment this line out if necessary
23 #
24 SHELL := cmd.exe
25
26 # define whether you want to use native gcc compiler or cross-compiler
27 # possible values: gcc
28 #                  i686-w64-mingw32-gcc
29 #                  x86_64-w64-mingw32-gcc
30 GCCBIN := gcc
31
32 ifeq ($(GCCBIN),x86_64-w64-mingw32-gcc)
33 GCCCROSS := x86_64-w64-mingw32
34 endif
35 ifeq ($(GCCBIN),i686-w64-mingw32-gcc)
36 GCCCROSS := i686-w64-mingw32
37 endif
38
39
40 ##
41 ## Build configuration.  Edit the values below to suit your needs.
42 ##
43
44 #
45 # Set these to wherever you want "gmake install" to put your
46 # newly built perl.
47 #
48 INST_DRV := c:
49 INST_TOP := $(INST_DRV)\perl
50
51 #
52 # Uncomment if you want to build a 32-bit Perl using a 32-bit compiler
53 # on a 64-bit version of Windows.
54 #
55 #WIN64          := undef
56
57 #
58 # Comment this out if you DON'T want your perl installation to be versioned.
59 # This means that the new installation will overwrite any files from the
60 # old installation at the same INST_TOP location.  Leaving it enabled is
61 # the safest route, as perl adds the extra version directory to all the
62 # locations it installs files to.  If you disable it, an alternative
63 # versioned installation can be obtained by setting INST_TOP above to a
64 # path that includes an arbitrary version string.
65 #
66 #INST_VER       := \5.35.8
67
68 #
69 # Comment this out if you DON'T want your perl installation to have
70 # architecture specific components.  This means that architecture-
71 # specific files will be installed along with the architecture-neutral
72 # files.  Leaving it enabled is safer and more flexible, in case you
73 # want to build multiple flavors of perl and install them together in
74 # the same location.  Commenting it out gives you a simpler
75 # installation that is easier to understand for beginners.
76 #
77 #INST_ARCH      := \$(ARCHNAME)
78
79 #
80 # Uncomment this if you want perl to run
81 #       $Config{sitelibexp}\sitecustomize.pl
82 # before anything else.  This script can then be set up, for example,
83 # to add additional entries to @INC.
84 #
85 #USE_SITECUST   := define
86
87 #
88 # uncomment to enable multiple interpreters.  This is needed for fork()
89 # emulation and for thread support, and is auto-enabled by USE_IMP_SYS
90 # and USE_ITHREADS below.
91 #
92 USE_MULTI       := define
93
94 #
95 # Interpreter cloning/threads; now reasonably complete.
96 # This should be enabled to get the fork() emulation.  This needs (and
97 # will auto-enable) USE_MULTI above.
98 #
99 USE_ITHREADS    := define
100
101 #
102 # uncomment to enable the implicit "host" layer for all system calls
103 # made by perl.  This is also needed to get fork().  This needs (and
104 # will auto-enable) USE_MULTI above.
105 #
106 USE_IMP_SYS     := define
107
108 #
109 # Comment out next assign to disable perl's I/O subsystem and use compiler's
110 # stdio for IO - depending on your compiler vendor and run time library you may
111 # then get a number of fails from make test i.e. bugs - complain to them not us ;-).
112 # You will also be unable to take full advantage of perl5.8's support for multiple
113 # encodings and may see lower IO performance. You have been warned.
114 #
115 USE_PERLIO      := define
116
117 #
118 # Uncomment this if you're building a 32-bit perl and want 64-bit integers.
119 # (If you're building a 64-bit perl then you will have 64-bit integers whether
120 # or not this is uncommented.)
121 #
122 #USE_64_BIT_INT := define
123
124 #
125 # Uncomment this if you want to support the use of long doubles in GCC builds.
126 # This option is not supported for MSVC builds.
127 #
128 #USE_LONG_DOUBLE := define
129
130 #
131 # Uncomment these if you want to support the use of __float128 in GCC builds.
132 # This option is not supported for MSVC builds.
133 #
134 #USE_QUADMATH := define
135 #I_QUADMATH := define
136
137 #
138 # Comment this out if you want to build perl without __USE_MINGW_ANSI_STDIO defined.
139 # (If you're building perl with USE_LONG_DOUBLE defined then
140 # __USE_MINGW_ANSI_STDIO will be defined whether or not this is uncommented.)
141 # The advantage of defining __USE_MINGW_ANSI_STDIO is that it provides correct
142 # (s)printf formatting of numbers, whereas the MS runtime might not.
143 # This option has no effect on MSVC builds.
144 #
145 USE_MINGW_ANSI_STDIO := define
146
147 #
148 # Comment this out if you want the legacy default behavior of including '.' at
149 # the end of @INC.
150 #
151 DEFAULT_INC_EXCLUDES_DOT := define
152
153 #
154 # Uncomment this if you want to disable looking up values from
155 # HKEY_CURRENT_USER\Software\Perl and HKEY_LOCAL_MACHINE\Software\Perl in
156 # the Registry.
157 #
158 #USE_NO_REGISTRY := define
159
160 #
161 # uncomment exactly one of the following
162 #
163 # Visual C++ 2013 (aka Visual C++ 12.0) (full version or Express Edition)
164 #CCTYPE         := MSVC120
165 # Visual C++ 2015 (aka Visual C++ 14.0) (full version or Express Edition)
166 #CCTYPE         := MSVC140
167 # Visual C++ 2017 (aka Visual C++ 14.1) (full version or Community Edition)
168 #CCTYPE         := MSVC141
169 # Visual C++ 2019 (aka Visual C++ 14.2) (full version or Community Edition)
170 #CCTYPE         := MSVC142
171 # Visual C++ 2022 (aka Visual C++ 14.3) (full version or Community Edition)
172 #CCTYPE         := MSVC143
173 # MinGW or mingw-w64 with gcc-3.4.5 or later
174 #CCTYPE         := GCC
175
176 #
177 # If you are using Intel C++ Compiler uncomment this
178 #
179 #__ICC          := define
180
181 #
182 # Uncomment this if you want to build everything in C++ mode
183 #
184 #USE_CPLUSPLUS  := define
185
186 #
187 # uncomment next line if you want debug version of perl (big/slow)
188 # If not enabled, we automatically try to use maximum optimization
189 # with all compilers that are known to have a working optimizer.
190 #
191 #CFG            := Debug
192
193 #
194 # uncomment to enable linking with setargv.obj under the Visual C
195 # compiler. Setting this options enables perl to expand wildcards in
196 # arguments, but it may be harder to use alternate methods like
197 # File::DosGlob that are more powerful.  This option is supported only with
198 # Visual C.
199 #
200 #USE_SETARGV    := define
201
202 #
203 # set this if you wish to use perl's malloc
204 # WARNING: Turning this on/off WILL break binary compatibility with extensions
205 # you may have compiled with/without it.  Be prepared to recompile all
206 # extensions if you change the default.  Currently, this cannot be enabled
207 # if you ask for USE_IMP_SYS above.
208 #
209 #PERL_MALLOC    := define
210
211 #
212 # set this to enable debugging mstats
213 # This must be enabled to use the Devel::Peek::mstat() function.  This cannot
214 # be enabled without PERL_MALLOC as well.
215 #
216 #DEBUG_MSTATS   := define
217
218 #
219 # set this to additionally provide a statically linked perl-static.exe.
220 # Note that dynamic loading will not work with this perl, so you must
221 # include required modules statically using the STATIC_EXT or ALL_STATIC
222 # variables below. A static library perl535s.lib will also be created.
223 # Ordinary perl.exe is not affected by this option.
224 #
225 #BUILD_STATIC   := define
226
227 #
228 # in addition to BUILD_STATIC the option ALL_STATIC makes *every*
229 # extension get statically built.
230 # This will result in a very large perl executable, but the main purpose
231 # is to have proper linking set so as to be able to create miscellaneous
232 # executables with different built-in extensions. It implies BUILD_STATIC.
233 #
234 #ALL_STATIC     := define
235
236 #
237 # set the install locations of the compiler
238 # Running VCVARS32.BAT, VCVARSALL.BAT or similar is *required* when using
239 # Visual C++.
240 #
241 # For GCC builds this should be the directory containing the bin, include,
242 # lib directories for your compiler.
243 #
244 #CCHOME         := C:\MinGW
245
246 #
247 # Additional compiler flags can be specified here.
248 #
249 BUILDOPT        := $(BUILDOPTEXTRA)
250
251 #
252 # This should normally be disabled.  Enabling it will disable the File::Glob
253 # implementation of CORE::glob.
254 #
255 #BUILDOPT       += -DPERL_EXTERNAL_GLOB
256
257 #
258 # Perl needs to read scripts in text mode so that the DATA filehandle
259 # works correctly with seek() and tell(), or around auto-flushes of
260 # all filehandles (e.g. by system(), backticks, fork(), etc).
261 #
262 # The current version on the ByteLoader module on CPAN however only
263 # works if scripts are read in binary mode.  But before you disable text
264 # mode script reading (and break some DATA filehandle functionality)
265 # please check first if an updated ByteLoader isn't available on CPAN.
266 #
267 BUILDOPT        += -DPERL_TEXTMODE_SCRIPTS
268
269 #
270 # specify semicolon-separated list of extra directories that modules will
271 # look for libraries (spaces in path names need not be quoted)
272 #
273 EXTRALIBDIRS    :=
274
275 #
276 # set this to your email address (perl will guess a value from
277 # your loginname and your hostname, which may not be right)
278 #
279 #EMAIL          :=
280
281 ##
282 ## Build configuration ends.
283 ##
284
285 ##################### CHANGE THESE ONLY IF YOU MUST #####################
286
287 PERL_MALLOC     ?= undef
288 DEBUG_MSTATS    ?= undef
289
290 USE_SITECUST    ?= undef
291 USE_MULTI       ?= undef
292 USE_ITHREADS    ?= undef
293 USE_IMP_SYS     ?= undef
294 USE_PERLIO      ?= undef
295 USE_LARGE_FILES ?= undef
296 USE_64_BIT_INT  ?= undef
297 USE_LONG_DOUBLE ?= undef
298 USE_QUADMATH    ?= undef
299 I_QUADMATH      ?= undef
300 DEFAULT_INC_EXCLUDES_DOT ?= undef
301 USE_NO_REGISTRY ?= undef
302
303 ifeq ($(USE_IMP_SYS),define)
304 PERL_MALLOC     = undef
305 endif
306
307 ifeq ($(PERL_MALLOC),undef)
308 DEBUG_MSTATS    = undef
309 endif
310
311 ifeq ($(DEBUG_MSTATS),define)
312 BUILDOPT        += -DPERL_DEBUGGING_MSTATS
313 endif
314
315 ifeq ("$(USE_IMP_SYS) $(USE_MULTI)","define undef")
316 USE_MULTI       = define
317 endif
318
319 ifeq ("$(USE_ITHREADS) $(USE_MULTI)","define undef")
320 USE_MULTI       = define
321 endif
322
323 ifeq ($(USE_SITECUST),define)
324 BUILDOPT        += -DUSE_SITECUSTOMIZE
325 endif
326
327 ifneq ($(USE_MULTI),undef)
328 BUILDOPT        += -DMULTIPLICITY
329 endif
330
331 ifneq ($(USE_IMP_SYS),undef)
332 BUILDOPT        += -DPERL_IMPLICIT_SYS
333 endif
334
335 ifeq ($(USE_NO_REGISTRY),define)
336 BUILDOPT        += -DWIN32_NO_REGISTRY
337 endif
338
339 ifeq ($(CCTYPE),GCC)
340 GCCTARGET       := $(shell $(GCCBIN) -dumpmachine)
341 endif
342
343 #no explicit CCTYPE given, do auto detection
344 ifeq ($(CCTYPE),)
345 GCCTARGET       := $(shell $(GCCBIN) -dumpmachine 2>NUL)
346 #do we have a GCC?
347 ifneq ($(GCCTARGET),)
348 CCTYPE          := GCC
349 else
350 WIN64           := $(shell for /f "tokens=3 delims=.^ " \
351         %%i in ('cl ^2^>^&1') do @if "%%i" == "32-bit" echo undef)
352 #major version of CL has diff position based on 32 vs 64
353 #Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
354 #Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
355 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output
356 #removing the cmd /c (extra scope) on the echo causes the env var to be undef
357 #when echo executes but it isn't undef for the "set MSVCVER", gmake or
358 #cmd.exe bug?
359 ifeq ($(WIN64),undef)
360 MSVCVER         := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \
361         %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \
362         (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \
363         else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%)
364 else
365 MSVCVER         := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \
366         %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \
367         (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \
368         else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%)
369 endif
370 #autodetect failed, reset to empty string
371 ifeq ($(MSVCVER),-50)
372 CCTYPE          := 
373 else
374 CCTYPE          := MSVC$(MSVCVER)
375 endif
376 endif
377 endif
378
379 # Versions of Visual C++ up to VC++ 14.0 define $(VCINSTALLDIR), but for
380 # VC++ 14.1 we need the subfolder given by $(VCToolsInstallDir).
381 ifeq ($(CCHOME),)
382 ifeq ($(CCTYPE),GCC)
383 CCHOME          := C:\MinGW
384 else ifeq ($(CCTYPE),MSVC120)
385 CCHOME          := $(VCINSTALLDIR)
386 else ifeq ($(CCTYPE),MSVC140)
387 CCHOME          := $(VCINSTALLDIR)
388 else
389 CCHOME          := $(VCToolsInstallDir)
390 endif
391 endif
392
393 # Check processor architecture from target triplet
394 # possible values:
395 # gcc: i686-w64-mingw32, x86_64-w64-mingw32
396 # clang: i686-w64-windows-gnu, x86_64-w64-windows-gnu
397 ifeq ($(CCTYPE),GCC)
398 ifeq (x86_64, $(findstring x86_64, $(GCCTARGET)))
399 WIN64 := define
400 PROCESSOR_ARCHITECTURE := x64
401 endif
402 ifeq (i686, $(findstring i686, $(GCCTARGET)))
403 WIN64 := undef
404 PROCESSOR_ARCHITECTURE := x86
405 endif
406 endif
407
408 PROCESSOR_ARCHITECTURE  ?= x86
409
410 ifeq ($(WIN64),undef)
411 PROCESSOR_ARCHITECTURE  = x86
412 endif
413
414 ifeq ($(WIN64),)
415 # When we are running from a 32bit cmd.exe on AMD64 then
416 # PROCESSOR_ARCHITECTURE is set to x86 and PROCESSOR_ARCHITEW6432
417 # is set to AMD64
418 ifneq ($(PROCESSOR_ARCHITEW6432),)
419 PROCESSOR_ARCHITECTURE  = $(PROCESSOR_ARCHITEW6432)
420 WIN64                   = define
421 else ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
422 WIN64                   = define
423 else ifeq ($(PROCESSOR_ARCHITECTURE),IA64)
424 WIN64                   = define
425 else
426 WIN64                   = undef
427 endif
428 endif
429
430 ifeq ($(WIN64),define)
431 USE_64_BIT_INT  = define
432 endif
433
434 # Disable the long double option for MSVC builds since that compiler
435 # does not support it.
436 ifneq ($(CCTYPE),GCC)
437 USE_LONG_DOUBLE = undef
438 USE_QUADMATH = undef
439 I_QUADMATH = undef
440 endif
441
442 ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
443 ifeq ($(ARCHITECTURE),AMD64)
444 ARCHITECTURE    = x64
445 endif
446 ifeq ($(ARCHITECTURE),IA64)
447 ARCHITECTURE    = ia64
448 endif
449
450 ifeq ($(USE_MULTI),define)
451 ARCHNAME        = MSWin32-$(ARCHITECTURE)-multi
452 else
453 ifeq ($(USE_PERLIO),define)
454 ARCHNAME        = MSWin32-$(ARCHITECTURE)-perlio
455 else
456 ARCHNAME        = MSWin32-$(ARCHITECTURE)
457 endif
458 endif
459
460 ifeq ($(USE_PERLIO),define)
461 BUILDOPT        += -DUSE_PERLIO
462 endif
463
464 ifeq ($(USE_ITHREADS),define)
465 ARCHNAME        := $(ARCHNAME)-thread
466 endif
467
468 ifneq ($(WIN64),define)
469 ifeq ($(USE_64_BIT_INT),define)
470 ARCHNAME        := $(ARCHNAME)-64int
471 endif
472 endif
473
474 ifeq ($(USE_LONG_DOUBLE),define)
475 ARCHNAME        := $(ARCHNAME)-ld
476 endif
477
478 ifeq ($(USE_QUADMATH),define)
479 ARCHNAME        := $(ARCHNAME)-quadmath
480 endif
481
482 ifeq ($(CCTYPE),GCC)
483 GCCVER          := $(shell $(GCCBIN) -dumpversion)
484 GCCVER1         := $(shell for /f "delims=. tokens=1,2,3" %%i in ('$(GCCBIN) -dumpversion') do echo %%i)
485 GCCVER2         := $(shell for /f "delims=. tokens=1,2,3" %%i in ('$(GCCBIN) -dumpversion') do echo %%j)
486 GCCVER3         := $(shell for /f "delims=. tokens=1,2,3" %%i in ('$(GCCBIN) -dumpversion') do echo %%k)
487 endif
488
489 # Set the install location of the compiler headers/libraries.
490 # These are saved into $Config{incpath} and $Config{libpth}.
491 ifneq ($(GCCCROSS),)
492 CCINCDIR := $(CCHOME)\$(GCCCROSS)\include
493 CCLIBDIR := $(CCHOME)\$(GCCCROSS)\lib
494 ARCHPREFIX := $(GCCCROSS)-
495 else ifeq ($(CCTYPE),GCC)
496 CCINCDIR := $(CCHOME)\include
497 CCLIBDIR := $(CCHOME)\lib;$(CCHOME)\$(GCCTARGET)\lib;$(CCHOME)\lib\gcc\$(GCCTARGET)\$(GCCVER)
498 ARCHPREFIX :=
499 else
500 CCINCDIR := $(CCHOME)\include
501 ifeq ($(CCTYPE),MSVC120)
502 ifeq ($(WIN64),define)
503 CCLIBDIR := $(CCHOME)\lib\amd64
504 else
505 CCLIBDIR := $(CCHOME)\lib
506 endif
507 else ifeq ($(CCTYPE),MSVC140)
508 ifeq ($(WIN64),define)
509 CCLIBDIR := $(CCHOME)\lib\amd64
510 else
511 CCLIBDIR := $(CCHOME)\lib
512 endif
513 else
514 ifeq ($(WIN64),define)
515 CCLIBDIR := $(CCHOME)\lib\x64
516 else
517 CCLIBDIR := $(CCHOME)\lib\x86
518 endif
519 endif
520 ARCHPREFIX :=
521 endif
522
523 # Set DLL location for GCC compilers.
524 ifeq ($(CCTYPE),GCC)
525 ifneq ($(GCCCROSS),)
526 CCDLLDIR := $(CCHOME)\$(GCCCROSS)\lib
527 else
528 CCDLLDIR := $(CCHOME)\bin
529 endif
530 endif
531
532 ARCHDIR         = ..\lib\$(ARCHNAME)
533 COREDIR         = ..\lib\CORE
534 AUTODIR         = ..\lib\auto
535 LIBDIR          = ..\lib
536 EXTDIR          = ..\ext
537 DISTDIR         = ..\dist
538 CPANDIR         = ..\cpan
539 PODDIR          = ..\pod
540 HTMLDIR         = .\html
541
542 INST_SCRIPT     = $(INST_TOP)$(INST_VER)\bin
543 INST_BIN        = $(INST_SCRIPT)$(INST_ARCH)
544 INST_LIB        = $(INST_TOP)$(INST_VER)\lib
545 INST_ARCHLIB    = $(INST_LIB)$(INST_ARCH)
546 INST_COREDIR    = $(INST_ARCHLIB)\CORE
547 INST_HTML       = $(INST_TOP)$(INST_VER)\html
548
549 #
550 # Programs to compile, build .lib files and link
551 #
552
553 MINIBUILDOPT    :=
554
555 ifeq ($(CCTYPE),GCC)
556
557 CC              = $(ARCHPREFIX)gcc
558 LINK32          = $(ARCHPREFIX)g++
559 LIB32           = $(ARCHPREFIX)ar rc
560 IMPLIB          = $(ARCHPREFIX)dlltool
561 RSC             = $(ARCHPREFIX)windres
562
563 ifeq ($(USE_LONG_DOUBLE),define)
564 BUILDOPT        += -D__USE_MINGW_ANSI_STDIO
565 MINIBUILDOPT    += -D__USE_MINGW_ANSI_STDIO
566 else ifeq ($(USE_MINGW_ANSI_STDIO),define)
567 BUILDOPT        += -D__USE_MINGW_ANSI_STDIO
568 MINIBUILDOPT    += -D__USE_MINGW_ANSI_STDIO
569 endif
570
571
572 # By default add -fwrapv, since we depend on 2's complement behaviour
573 # for signed numbers.
574 # See https://github.com/Perl/perl5/issues/13690
575 #
576 GCCWRAPV := define
577
578 ifeq ($(GCCWRAPV),define)
579 BUILDOPT        += -fwrapv
580 MINIBUILDOPT    += -fwrapv
581 endif
582
583 i = .i
584 o = .o
585 a = .a
586
587 #
588 # Options
589 #
590
591 INCLUDES        = -I.\include -I. -I..
592 DEFINES         = -DWIN32
593 ifeq ($(WIN64),define)
594 DEFINES         += -DWIN64
595 endif
596 LOCDEFS         = -DPERLDLL -DPERL_CORE
597 CXX_FLAG        = -xc++
598 LIBC            =
599 LIBFILES        = $(LIBC) -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool \
600         -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 \
601         -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
602
603 ifeq ($(USE_QUADMATH),define)
604 LIBFILES        += -lquadmath
605 endif
606
607 ifeq ($(CFG),Debug)
608 OPTIMIZE        = -g -O2
609 LINK_DBG        = -g
610 DEFINES         += -DDEBUGGING
611 else
612 OPTIMIZE        = -O2
613 LINK_DBG        = -s
614 endif
615
616 EXTRACFLAGS     =
617 ifeq ($(USE_CPLUSPLUS),define)
618 EXTRACFLAGS     += $(CXX_FLAG)
619 endif
620 CFLAGS          = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE)
621 LINK_FLAGS      = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(subst ;," -L",$(CCLIBDIR))"
622 OBJOUT_FLAG     = -o
623 EXEOUT_FLAG     = -o
624 LIBOUT_FLAG     =
625 PDBOUT          =
626
627 BUILDOPT        += -fno-strict-aliasing -mms-bitfields
628 MINIBUILDOPT    += -fno-strict-aliasing
629
630 TESTPREPGCC     = test-prep-gcc
631
632 else
633
634 o = .obj
635
636 # Loading DLLs on demand makes the test suite run in about 10% less time.
637 # If no registry, advapi32 is only used for Perl_pp_getlogin/getlogin/GetUserNameA
638 # which is rare to execute
639 ifneq ($(USE_NO_REGISTRY),undef)
640 DELAYLOAD       = -DELAYLOAD:ws2_32.dll -DELAYLOAD:advapi32.dll delayimp.lib
641 MINIDELAYLOAD   =
642 else
643 DELAYLOAD       = -DELAYLOAD:ws2_32.dll delayimp.lib
644 #miniperl never does any registry lookups
645 MINIDELAYLOAD   = -DELAYLOAD:advapi32.dll
646 endif
647
648 ifneq ($(__ICC),define)
649 CC              = cl
650 LINK32          = link
651 else
652 CC              = icl
653 LINK32          = xilink
654 endif
655 LIB32           = $(LINK32) -lib
656 RSC             = rc
657
658 #
659 # Options
660 #
661
662 INCLUDES        = -I.\include -I. -I..
663 #PCHFLAGS       = -Fpc:\temp\vcmoduls.pch -YX
664 DEFINES         = -DWIN32 -D_CONSOLE -DNO_STRICT
665 LOCDEFS         = -DPERLDLL -DPERL_CORE
666 CXX_FLAG        = -TP -EHsc
667 EXTRACFLAGS     = -nologo -GF -W3
668
669 ifeq ($(CCTYPE),MSVC120)
670 LIBC            = msvcrt.lib
671 else
672 LIBC            = ucrt.lib
673 endif
674
675 ifeq ($(CFG),Debug)
676 OPTIMIZE        = -Od -Zi
677 LINK_DBG        = -debug
678 DEFINES         += -DDEBUGGING
679 EXTRACFLAGS     += -MD
680 else ifeq ($(CFG),DebugSymbols)
681 OPTIMIZE        = -Od -Zi
682 LINK_DBG        = -debug
683 EXTRACFLAGS     += -MD
684 else ifeq ($(CFG),DebugFull)
685 ifeq ($(CCTYPE),MSVC120)
686 LIBC            = msvcrtd.lib
687 else
688 LIBC            = ucrtd.lib
689 endif
690 OPTIMIZE        = -Od -Zi
691 LINK_DBG        = -debug
692 DEFINES         += -D_DEBUG -DDEBUGGING
693 EXTRACFLAGS     += -MDd
694
695 else
696 # Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG).
697 # -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
698 OPTIMIZE        = -O1 -Zi -GL
699 # we enable debug symbols in release builds also
700 LINK_DBG        = -debug -opt:ref,icf -ltcg
701 # you may want to enable this if you want COFF symbols in the executables
702 # in addition to the PDB symbols.  The default Dr. Watson that ships with
703 # Windows can use the former but not latter.  The free WinDbg can be
704 # installed to get better stack traces from just the PDB symbols, so we
705 # avoid the bloat of COFF symbols by default.
706 #LINK_DBG       += -debugtype:both
707 LIB_FLAGS       = -ltcg
708 EXTRACFLAGS     += -MD
709 endif
710
711 ifeq ($(WIN64),define)
712 DEFINES         += -DWIN64
713 OPTIMIZE        += -fp:precise
714 endif
715
716 # For now, silence warnings about "unsafe" CRT functions
717 # and POSIX CRT function names being deprecated.
718 DEFINES         += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
719
720 # Likewise for deprecated Winsock APIs in VC++ 14.0 onwards for now.
721 ifneq ($(CCTYPE),MSVC120)
722 DEFINES         += -D_WINSOCK_DEPRECATED_NO_WARNINGS
723 endif
724
725 LIBBASEFILES    = oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
726         comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
727         netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib \
728         odbc32.lib odbccp32.lib comctl32.lib
729
730 ifneq ($(CCTYPE),MSVC120)
731 ifeq ($(CFG),DebugFull)
732 LIBBASEFILES    += msvcrtd.lib vcruntimed.lib
733 else
734 LIBBASEFILES    += msvcrt.lib vcruntime.lib
735 endif
736 endif
737
738 # Avoid __intel_new_proc_init link error for libircmt.
739 # libmmd is /MD equivelent, other variants exist.
740 # libmmd is Intel C's math addon funcs to MS CRT, contains long doubles, C99,
741 # and optimized C89 funcs
742 ifeq ($(__ICC),define)
743 LIBBASEFILES    += libircmt.lib libmmd.lib
744 endif
745
746 LIBFILES        = $(LIBBASEFILES) $(LIBC)
747
748 ifeq ($(__ICC),define)
749 EXTRACFLAGS     += -Qstd=c99
750 endif
751 ifeq ($(USE_CPLUSPLUS),define)
752 EXTRACFLAGS     += $(CXX_FLAG)
753 endif
754 CFLAGS          = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \
755                 $(PCHFLAGS) $(OPTIMIZE)
756 LINK_FLAGS      = -nologo -nodefaultlib $(LINK_DBG) \
757                 -libpath:"$(INST_COREDIR)" \
758                 -machine:$(PROCESSOR_ARCHITECTURE)
759 LIB_FLAGS       += -nologo
760 OBJOUT_FLAG     = -Fo
761 EXEOUT_FLAG     = -Fe
762 LIBOUT_FLAG     = /out:
763 PDBOUT          = -Fd$(*).pdb
764 TESTPREPGCC     =
765
766 endif
767
768 CFLAGS_O        = $(CFLAGS) $(BUILDOPT)
769
770 RSC_FLAGS       =
771
772 # VS 2017 (VC++ 14.1) requires at minimum Windows 7 SP1 (with latest Windows Updates)
773
774 # For XP support in >= VS 2013 (VC++ 12.0), subsystem is always in Config.pm
775 # LINK_FLAGS.
776
777 ifneq ($(CCTYPE),GCC)
778 ifeq ($(WIN64),define)
779 LINK_FLAGS      += -subsystem:console,"5.02"
780 else
781 LINK_FLAGS      += -subsystem:console,"5.01"
782 endif
783 endif
784
785 BLINK_FLAGS     = $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
786
787 #################### do not edit below this line #######################
788 ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
789
790 #prevent -j from reaching EUMM/make_ext.pl/"sub makes", Win32 EUMM not parallel
791 #compatible yet
792 unexport MAKEFLAGS
793
794 a ?= .lib
795
796 .SUFFIXES : .c .i $(o) .dll $(a) .exe .rc .res
797
798 %$(o): %.c
799         $(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $(PDBOUT) $<
800
801 %.i: %.c
802         $(CC) -c -I$(<D) $(CFLAGS_O) -E $< >$@
803
804 %.c: %.y
805         $(NOOP)
806
807 %.dll: %$(o)
808         $(LINK32) -o $@ $(BLINK_FLAGS) $< $(LIBFILES)
809         $(IMPLIB) --input-def $(*F).def --output-lib $(*F).a $@
810
811 %.res: %.rc
812 ifeq ($(CCTYPE),GCC)
813         $(RSC) --use-temp-file --include-dir=. --include-dir=.. -O COFF -D INCLUDE_MANIFEST -i $< -o $@
814 else
815         $(RSC) -i.. -DINCLUDE_MANIFEST $<
816 endif
817
818 #
819 # various targets
820
821 #do not put $(MINIPERL) as a dep/prereq in a rule, instead put $(HAVEMINIPERL)
822 #$(MINIPERL) is not a buildable target, use "gmake mp" if you want to just build
823 #miniperl alone
824 MINIPERL        = ..\miniperl.exe
825 HAVEMINIPERL    = ..\lib\buildcustomize.pl
826 MINIDIR         = mini
827 PERLEXE         = ..\perl.exe
828 WPERLEXE        = ..\wperl.exe
829 PERLEXESTATIC   = ..\perl-static.exe
830 STATICDIR       = .\static.tmp
831 GLOBEXE         = ..\perlglob.exe
832 CONFIGPM        = ..\lib\Config.pm
833 GENUUDMAP       = ..\generate_uudmap.exe
834 ifeq ($(BUILD_STATIC),define)
835 PERLSTATIC      = static
836 else
837 ifeq ($(ALL_STATIC),define)
838 PERLSTATIC      = static
839 else
840 PERLSTATIC      =
841 endif
842 endif
843
844 # Unicode data files generated by mktables
845 UNIDATAFILES     = ..\lib\unicore\Decomposition.pl ..\lib\unicore\TestProp.pl \
846                    ..\lib\unicore\CombiningClass.pl ..\lib\unicore\Name.pl \
847                    ..\lib\unicore\UCD.pl ..\lib\unicore\Name.pm            \
848                    ..\lib\unicore\mktables.lst
849
850 # Directories of Unicode data files generated by mktables
851 UNIDATADIR1     = ..\lib\unicore\To
852 UNIDATADIR2     = ..\lib\unicore\lib
853
854 PERLEXE_MANIFEST= .\perlexe.manifest
855 PERLEXE_ICO     = .\perlexe.ico
856 PERLEXE_RES     = .\perlexe.res
857 PERLDLL_RES     =
858
859 # Nominate a target which causes extensions to be re-built
860 # This used to be $(PERLEXE), but at worst it is the .dll that they depend
861 # on and really only the interface - i.e. the .def file used to export symbols
862 # from the .dll
863 PERLDEP = $(PERLIMPLIB)
864
865
866 PL2BAT          = bin\pl2bat.pl
867
868 UTILS           =                       \
869                 ..\utils\h2ph           \
870                 ..\utils\splain         \
871                 ..\utils\perlbug        \
872                 ..\utils\pl2pm          \
873                 ..\utils\h2xs           \
874                 ..\utils\perldoc        \
875                 ..\utils\perlivp        \
876                 ..\utils\libnetcfg      \
877                 ..\utils\enc2xs         \
878                 ..\utils\encguess       \
879                 ..\utils\piconv         \
880                 ..\utils\corelist       \
881                 ..\utils\cpan           \
882                 ..\utils\xsubpp         \
883                 ..\utils\pod2html       \
884                 ..\utils\prove          \
885                 ..\utils\ptar           \
886                 ..\utils\ptardiff       \
887                 ..\utils\ptargrep       \
888                 ..\utils\zipdetails     \
889                 ..\utils\shasum         \
890                 ..\utils\instmodsh      \
891                 ..\utils\json_pp        \
892                 bin\exetype.pl          \
893                 bin\runperl.pl          \
894                 bin\pl2bat.pl           \
895                 bin\perlglob.pl         \
896                 bin\search.pl
897
898 ifeq ($(CCTYPE),GCC)
899
900 CFGSH_TMPL      = config.gc
901 CFGH_TMPL       = config_H.gc
902 PERLIMPLIB      = $(COREDIR)\libperl535$(a)
903 PERLIMPLIBBASE  = libperl535$(a)
904 PERLSTATICLIB   = ..\libperl535s$(a)
905 INT64           = long long
906
907 else
908
909 CFGSH_TMPL      = config.vc
910 CFGH_TMPL       = config_H.vc
911 INT64           = __int64
912
913 endif
914
915 # makedef.pl must be updated if this changes, and this should normally
916 # only change when there is an incompatible revision of the public API.
917 PERLIMPLIB      ?= $(COREDIR)\perl535$(a)
918 PERLIMPLIBBASE  ?= perl535$(a)
919 PERLEXPLIB      ?= $(COREDIR)\perl535.exp
920 PERLSTATICLIB   ?= ..\perl535s$(a)
921 PERLDLL         = ..\perl535.dll
922 PERLDLLBASE     = perl535.dll
923
924 # don't let "gmake -n all" try to run "miniperl.exe make_ext.pl"
925 PLMAKE          = gmake
926
927 XCOPY           = xcopy /f /r /i /d /y
928 RCOPY           = xcopy /f /r /i /e /d /y
929 NOOP            = @rem
930
931 #first ones are arrange in compile time order for faster parallel building
932 #see #123867 for details
933 MICROCORE_SRC   =               \
934                 ..\toke.c       \
935                 ..\regcomp.c    \
936                 ..\regexec.c    \
937                 ..\op.c         \
938                 ..\sv.c         \
939                 ..\pp.c         \
940                 ..\pp_ctl.c     \
941                 ..\pp_sys.c     \
942                 ..\pp_pack.c    \
943                 ..\pp_hot.c     \
944                 ..\gv.c         \
945                 ..\perl.c       \
946                 ..\utf8.c       \
947                 ..\dump.c       \
948                 ..\hv.c         \
949                 ..\av.c         \
950                 ..\builtin.c    \
951                 ..\caretx.c     \
952                 ..\deb.c        \
953                 ..\doio.c       \
954                 ..\doop.c       \
955                 ..\dquote.c     \
956                 ..\globals.c    \
957                 ..\mro_core.c   \
958                 ..\locale.c     \
959                 ..\keywords.c   \
960                 ..\mathoms.c    \
961                 ..\mg.c         \
962                 ..\numeric.c    \
963                 ..\pad.c        \
964                 ..\perly.c      \
965                 ..\pp_sort.c    \
966                 ..\reentr.c     \
967                 ..\run.c        \
968                 ..\scope.c      \
969                 ..\taint.c      \
970                 ..\time64.c     \
971                 ..\universal.c  \
972                 ..\util.c
973
974 EXTRACORE_SRC   += perllib.c
975
976 ifeq ($(PERL_MALLOC),define)
977 EXTRACORE_SRC   += ..\malloc.c
978 endif
979
980 EXTRACORE_SRC   += ..\perlio.c
981
982 WIN32_SRC       =               \
983                 .\win32.c       \
984                 .\win32sck.c    \
985                 .\win32thread.c \
986                 .\fcrypt.c
987
988 CORE_NOCFG_H    =               \
989                 ..\av.h         \
990                 ..\cop.h        \
991                 ..\cv.h         \
992                 ..\dosish.h     \
993                 ..\embed.h      \
994                 ..\form.h       \
995                 ..\gv.h         \
996                 ..\handy.h      \
997                 ..\hv.h         \
998                 ..\hv_func.h    \
999                 ..\iperlsys.h   \
1000                 ..\mg.h         \
1001                 ..\nostdio.h    \
1002                 ..\op.h         \
1003                 ..\opcode.h     \
1004                 ..\perl.h       \
1005                 ..\perlapi.h    \
1006                 ..\perlsdio.h   \
1007                 ..\perly.h      \
1008                 ..\pp.h         \
1009                 ..\proto.h      \
1010                 ..\regcomp.h    \
1011                 ..\regexp.h     \
1012                 ..\scope.h      \
1013                 ..\sv.h         \
1014                 ..\thread.h     \
1015                 ..\unixish.h    \
1016                 ..\utf8.h       \
1017                 ..\util.h       \
1018                 ..\warnings.h   \
1019                 ..\XSUB.h       \
1020                 ..\EXTERN.h     \
1021                 ..\perlvars.h   \
1022                 ..\intrpvar.h   \
1023                 .\include\dirent.h      \
1024                 .\include\netdb.h       \
1025                 .\include\sys\errno2.h  \
1026                 .\include\sys\socket.h  \
1027                 .\win32.h
1028
1029 CORE_H          = $(CORE_NOCFG_H) .\config.h ..\git_version.h
1030
1031 UUDMAP_H        = ..\uudmap.h
1032 BITCOUNT_H      = ..\bitcount.h
1033 MG_DATA_H       = ..\mg_data.h
1034 GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)
1035
1036 HAVE_COREDIR    = .coreheaders
1037
1038 MICROCORE_OBJ   = $(MICROCORE_SRC:.c=$(o))
1039 CORE_OBJ        = $(MICROCORE_OBJ) $(EXTRACORE_SRC:.c=$(o))
1040 WIN32_OBJ       = $(WIN32_SRC:.c=$(o))
1041
1042 MINICORE_OBJ    = $(subst ..\,mini\,$(MICROCORE_OBJ))   \
1043                   $(MINIDIR)\miniperlmain$(o)   \
1044                   $(MINIDIR)\perlio$(o)
1045 MINIWIN32_OBJ   = $(subst .\,mini\,$(WIN32_OBJ))
1046 MINI_OBJ        = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
1047 DLL_OBJ         = $(DYNALOADER)
1048
1049 PERLDLL_OBJ     = $(CORE_OBJ)
1050 PERLEXE_OBJ     = perlmain$(o)
1051 PERLEXEST_OBJ   = perlmainst$(o)
1052
1053 PERLDLL_OBJ     += $(WIN32_OBJ) $(DLL_OBJ)
1054
1055 ifneq ($(USE_SETARGV),)
1056 SETARGV_OBJ     = setargv$(o)
1057 endif
1058
1059 ifeq ($(ALL_STATIC),define)
1060 # some exclusions, unfortunately, until fixed:
1061 #  - MakeMaker isn't capable enough for SDBM_File (small bug)
1062 STATIC_EXT      = * !SDBM_File
1063 NORMALIZE_STATIC = Normalize_static
1064 else
1065 # specify static extensions here, for example:
1066 # (be sure to include Win32CORE to load Win32 on demand)
1067 #STATIC_EXT     = Win32CORE Cwd Compress/Raw/Zlib
1068 STATIC_EXT      = Win32CORE
1069 NORMALIZE_DYN   = Normalize_dyn
1070 endif
1071
1072 DYNALOADER      = ..\DynaLoader$(o)
1073
1074 # vars must be separated by "\t+~\t+", since we're using the tempfile
1075 # version of config_sh.pl (we were overflowing someone's buffer by
1076 # trying to fit them all on the command line)
1077 #       -- BKS 10-17-1999
1078 CFG_VARS        =                                       \
1079                 "INST_TOP=$(INST_TOP)"                  \
1080                 "INST_VER=$(INST_VER)"                  \
1081                 "INST_ARCH=$(INST_ARCH)"                \
1082                 "archname=$(ARCHNAME)"                  \
1083                 "cc=$(CC)"                              \
1084                 "ld=$(LINK32)"                          \
1085                 "ccflags=$(subst ",\",$(EXTRACFLAGS) $(DEFINES) $(BUILDOPT))" \
1086                 "usecplusplus=$(USE_CPLUSPLUS)"         \
1087                 "cf_email=$(EMAIL)"                     \
1088                 "d_mymalloc=$(PERL_MALLOC)"             \
1089                 "i_quadmath=$(I_QUADMATH)"              \
1090                 "libs=$(LIBFILES)"                      \
1091                 "incpath=$(subst ",\",$(CCINCDIR))"                     \
1092                 "libperl=$(subst ",\",$(PERLIMPLIBBASE))"               \
1093                 "libpth=$(subst ",\",$(CCLIBDIR);$(EXTRALIBDIRS))"      \
1094                 "libc=$(LIBC)"                          \
1095                 "make=$(PLMAKE)"                                \
1096                 "_o=$(o)"                               \
1097                 "obj_ext=$(o)"                          \
1098                 "_a=$(a)"                               \
1099                 "lib_ext=$(a)"                          \
1100                 "static_ext=$(STATIC_EXT)"              \
1101                 "usethreads=$(USE_ITHREADS)"            \
1102                 "useithreads=$(USE_ITHREADS)"           \
1103                 "usemultiplicity=$(USE_MULTI)"          \
1104                 "useperlio=$(USE_PERLIO)"               \
1105                 "use64bitint=$(USE_64_BIT_INT)"         \
1106                 "uselongdouble=$(USE_LONG_DOUBLE)"      \
1107                 "usequadmath=$(USE_QUADMATH)"           \
1108                 "usesitecustomize=$(USE_SITECUST)"      \
1109                 "default_inc_excludes_dot=$(DEFAULT_INC_EXCLUDES_DOT)"  \
1110                 "LINK_FLAGS=$(subst ",\",$(LINK_FLAGS))"\
1111                 "optimize=$(subst ",\",$(OPTIMIZE))"    \
1112                 "ARCHPREFIX=$(ARCHPREFIX)"              \
1113                 "WIN64=$(WIN64)"
1114
1115 #
1116 # Top targets
1117 #
1118
1119 .PHONY: all info
1120
1121 all : info rebasePE Extensions_nonxs $(PERLSTATIC)
1122
1123 info :
1124 ifeq ($(CCTYPE),GCC)
1125         @echo # CCTYPE=$(CCTYPE)&& \
1126         echo # GCCBIN=$(GCCBIN)&& \
1127         echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \
1128         echo # GCCTARGET=$(GCCTARGET)&& \
1129         echo # GCCCROSS=$(GCCCROSS)&& \
1130         echo # WIN64=$(WIN64)&& \
1131         echo # ARCHITECTURE=$(ARCHITECTURE)&& \
1132         echo # ARCHNAME=$(ARCHNAME)&& \
1133         echo # MAKE=$(PLMAKE)
1134 else
1135         @echo # CCTYPE=$(CCTYPE)&& \
1136         echo # WIN64=$(WIN64)&& \
1137         echo # ARCHITECTURE=$(ARCHITECTURE)&& \
1138         echo # ARCHNAME=$(ARCHNAME)&& \
1139         echo # MAKE=$(PLMAKE)
1140 endif
1141 ifeq ($(CCTYPE),)
1142         @echo Unable to detect gcc and/or architecture!
1143         @exit 1
1144 endif
1145
1146
1147 ..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h
1148
1149 ..\regexec$(o) : ..\regnodes.h ..\regcharclass.h
1150
1151 reonly : ..\regnodes.h .\config.h ..\git_version.h $(GLOBEXE) $(HAVEMINIPERL)\
1152         $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE)                          \
1153         Extensions_reonly
1154
1155 static: $(PERLEXESTATIC)
1156
1157 #----------------------------------------------------------------
1158
1159 $(GLOBEXE) : perlglob.c
1160 ifeq ($(CCTYPE),GCC)
1161         $(LINK32) $(EXTRACFLAGS) $(OPTIMIZE) $(BLINK_FLAGS) -mconsole -o $@ perlglob.c $(LIBFILES)
1162 else
1163         $(CC) $(EXTRACFLAGS) $(OPTIMIZE) $(PDBOUT) -Fe$@ perlglob.c -link $(BLINK_FLAGS) \
1164         setargv$(o) $(LIBFILES)
1165 endif
1166
1167 ..\git_version.h : $(HAVEMINIPERL) ..\make_patchnum.pl
1168         $(MINIPERL) -I..\lib ..\make_patchnum.pl
1169
1170 # make sure that we recompile perl.c if the git version changes
1171 ..\perl$(o) : ..\git_version.h
1172
1173 ..\config.sh : $(CFGSH_TMPL) config_sh.PL FindExt.pm $(HAVEMINIPERL)
1174         $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
1175
1176 # This target is for when changes to the main config.sh happen.
1177 # Edit config.gc, then make perl using GCC in a minimal configuration (i.e.
1178 # with MULTI, ITHREADS, IMP_SYS, LARGE_FILES and PERLIO off), then make
1179 # this target to regenerate config_H.gc.
1180 regen_config_h:
1181         $(MINIPERL) -I..\lib config_sh.PL --prebuilt $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
1182         $(MINIPERL) -I..\lib ..\configpm --chdir=..
1183         -del /f $(CFGH_TMPL)
1184         -$(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)"
1185         rename config.h $(CFGH_TMPL)
1186
1187 $(CONFIGPM): ..\config.sh config_h.PL
1188         $(MINIPERL) -I..\lib ..\configpm --chdir=..
1189         -$(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)"
1190
1191 .\config.h : $(CONFIGPM)
1192
1193 # See the comment in Makefile.SH explaining this seemingly cranky ordering
1194 ..\lib\buildcustomize.pl : $(MINI_OBJ) ..\write_buildcustomize.pl
1195 ifeq ($(CCTYPE),GCC)
1196         $(LINK32) -mconsole -o $(MINIPERL) $(BLINK_FLAGS) $(MINI_OBJ) $(LIBFILES)
1197 else
1198         $(LINK32) -out:$(MINIPERL) $(BLINK_FLAGS) \
1199             $(DELAYLOAD) $(MINIDELAYLOAD) $(LIBFILES) $(MINI_OBJ)
1200
1201 endif
1202         $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl ..
1203
1204 #convinence target, get a working miniperl
1205 mp : $(CONFIGPM)
1206
1207 $(MINIDIR)\.exists : $(CFGH_TMPL)
1208         if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
1209 #
1210 # Copy the template config.h and set configurables at the end of it
1211 # as per the options chosen and compiler used.
1212 # Note: This config.h is only used to build miniperl.exe anyway, but
1213 # it's as well to have its options correct to be sure that it builds
1214 # and so that it's "-V" options are correct for use by makedef.pl. The
1215 # real config.h used to build perl.exe is generated from the top-level
1216 # config_h.SH by config_h.PL (run by miniperl.exe).
1217 #
1218 # MINIDIR generates config.h so miniperl.exe is not rebuilt when the 2nd
1219 # config.h is generated in CONFIGPM target, see also the comments for $(MINI_OBJ).
1220         copy $(CFGH_TMPL) config.h
1221         @(echo.&& \
1222         echo #ifndef _config_h_footer_&& \
1223         echo #define _config_h_footer_&& \
1224         echo #undef PTRSIZE&& \
1225         echo #undef SSize_t&& \
1226         echo #undef HAS_ATOLL&& \
1227         echo #undef HAS_STRTOLL&& \
1228         echo #undef HAS_STRTOULL&& \
1229         echo #undef Size_t_size&& \
1230         echo #undef IVTYPE&& \
1231         echo #undef UVTYPE&& \
1232         echo #undef IVSIZE&& \
1233         echo #undef UVSIZE&& \
1234         echo #undef NV_PRESERVES_UV&& \
1235         echo #undef NV_PRESERVES_UV_BITS&& \
1236         echo #undef IVdf&& \
1237         echo #undef UVuf&& \
1238         echo #undef UVof&& \
1239         echo #undef UVxf&& \
1240         echo #undef UVXf&& \
1241         echo #undef USE_64_BIT_INT&& \
1242         echo #undef Gconvert&& \
1243         echo #undef HAS_FREXPL&& \
1244         echo #undef HAS_ISNANL&& \
1245         echo #undef HAS_MODFL&& \
1246         echo #undef HAS_MODFL_PROTO&& \
1247         echo #undef HAS_SQRTL&& \
1248         echo #undef HAS_STRTOLD&& \
1249         echo #undef PERL_PRIfldbl&& \
1250         echo #undef PERL_PRIgldbl&& \
1251         echo #undef PERL_PRIeldbl&& \
1252         echo #undef PERL_SCNfldbl&& \
1253         echo #undef NVTYPE&& \
1254         echo #undef NVSIZE&& \
1255         echo #undef LONG_DOUBLESIZE&& \
1256         echo #undef NV_OVERFLOWS_INTEGERS_AT&& \
1257         echo #undef NVef&& \
1258         echo #undef NVff&& \
1259         echo #undef NVgf&& \
1260         echo #undef USE_LONG_DOUBLE&& \
1261         echo #undef I_QUADMATH&& \
1262         echo #undef USE_QUADMATH&& \
1263         echo #undef USE_CPLUSPLUS)>> config.h
1264 ifneq ($(CCTYPE),MSVC120)
1265         @(echo #undef FILE_ptr&& \
1266         echo #undef FILE_cnt&& \
1267         echo #undef FILE_base&& \
1268         echo #undef FILE_bufsiz&& \
1269         echo #define FILE_ptr^(fp^) PERLIO_FILE_ptr^(fp^)&& \
1270         echo #define FILE_cnt^(fp^) PERLIO_FILE_cnt^(fp^)&& \
1271         echo #define FILE_base^(fp^) PERLIO_FILE_base^(fp^)&& \
1272         echo #define FILE_bufsiz^(fp^) ^(PERLIO_FILE_cnt^(fp^) + PERLIO_FILE_ptr^(fp^) - PERLIO_FILE_base^(fp^)^)&& \
1273         echo #define I_STDBOOL)>> config.h
1274 endif
1275 ifeq ($(WIN64),define)
1276 ifeq ($(CCTYPE),GCC)
1277         @(echo #define LONG_DOUBLESIZE ^16)>> config.h
1278 else
1279         @(echo #define LONG_DOUBLESIZE ^8)>> config.h
1280 endif
1281         @(echo #define PTRSIZE ^8&& \
1282         echo #define SSize_t $(INT64)&& \
1283         echo #define HAS_ATOLL&& \
1284         echo #define HAS_STRTOLL&& \
1285         echo #define HAS_STRTOULL&& \
1286         echo #define Size_t_size ^8)>> config.h
1287 else
1288 ifeq ($(CCTYPE),GCC)
1289         @(echo #define LONG_DOUBLESIZE ^12)>> config.h
1290 else
1291         @(echo #define LONG_DOUBLESIZE ^8)>> config.h
1292 endif
1293         @(echo #define PTRSIZE ^4&& \
1294         echo #define SSize_t int&& \
1295         echo #undef HAS_ATOLL&& \
1296         echo #undef HAS_STRTOLL&& \
1297         echo #undef HAS_STRTOULL&& \
1298         echo #define Size_t_size ^4)>> config.h
1299 endif
1300 ifeq ($(USE_64_BIT_INT),define)
1301         @(echo #define IVTYPE $(INT64)&& \
1302         echo #define UVTYPE unsigned $(INT64)&& \
1303         echo #define IVSIZE ^8&& \
1304         echo #define UVSIZE ^8)>> config.h
1305 ifeq ($(USE_LONG_DOUBLE),define)
1306         @(echo #define NV_PRESERVES_UV&& \
1307         echo #define NV_PRESERVES_UV_BITS 64)>> config.h
1308 else ifeq ($(USE_QUADMATH),define)
1309         @(echo #define NV_PRESERVES_UV&& \
1310         echo #define NV_PRESERVES_UV_BITS 64)>> config.h
1311 else
1312         @(echo #undef NV_PRESERVES_UV&& \
1313         echo #define NV_PRESERVES_UV_BITS 53)>> config.h
1314 endif
1315         @(echo #define IVdf "I64d"&& \
1316         echo #define UVuf "I64u"&& \
1317         echo #define UVof "I64o"&& \
1318         echo #define UVxf "I64x"&& \
1319         echo #define UVXf "I64X"&& \
1320         echo #define USE_64_BIT_INT)>> config.h
1321 else
1322         @(echo #define IVTYPE long&& \
1323         echo #define UVTYPE unsigned long&& \
1324         echo #define IVSIZE ^4&& \
1325         echo #define UVSIZE ^4&& \
1326         echo #define NV_PRESERVES_UV&& \
1327         echo #define NV_PRESERVES_UV_BITS 32&& \
1328         echo #define IVdf "ld"&& \
1329         echo #define UVuf "lu"&& \
1330         echo #define UVof "lo"&& \
1331         echo #define UVxf "lx"&& \
1332         echo #define UVXf "lX"&& \
1333         echo #undef USE_64_BIT_INT)>> config.h
1334 endif
1335 ifeq ($(USE_LONG_DOUBLE),define)
1336         @(echo #define Gconvert^(x,n,t,b^) sprintf^(^(b^),"%%.*""Lg",^(n^),^(x^)^)&& \
1337         echo #define HAS_FREXPL&& \
1338         echo #define HAS_ISNANL&& \
1339         echo #define HAS_MODFL&& \
1340         echo #define HAS_MODFL_PROTO&& \
1341         echo #define HAS_SQRTL&& \
1342         echo #define HAS_STRTOLD&& \
1343         echo #define PERL_PRIfldbl "Lf"&& \
1344         echo #define PERL_PRIgldbl "Lg"&& \
1345         echo #define PERL_PRIeldbl "Le"&& \
1346         echo #define PERL_SCNfldbl "Lf"&& \
1347         echo #define NVTYPE long double&& \
1348         echo #define NVSIZE LONG_DOUBLESIZE&& \
1349         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&& \
1350         echo #define NVef "Le"&& \
1351         echo #define NVff "Lf"&& \
1352         echo #define NVgf "Lg"&& \
1353         echo #undef I_QUADMATH&& \
1354         echo #undef USE_QUADMATH&& \
1355         echo #define USE_LONG_DOUBLE)>> config.h
1356 else ifeq ($(USE_QUADMATH),define)
1357         @(echo #define Gconvert^(x,n,t,b^) sprintf^(^(b^),"%%.*""Lg",^(n^),^(x^)^)&& \
1358         echo #define HAS_FREXPL&& \
1359         echo #define HAS_ISNANL&& \
1360         echo #define HAS_MODFL&& \
1361         echo #define HAS_MODFL_PROTO&& \
1362         echo #define HAS_SQRTL&& \
1363         echo #define HAS_STRTOLD&& \
1364         echo #define PERL_PRIfldbl "Lf"&& \
1365         echo #define PERL_PRIgldbl "Lg"&& \
1366         echo #define PERL_PRIeldbl "Le"&& \
1367         echo #define PERL_SCNfldbl "Lf"&& \
1368         echo #define NVTYPE __float128&& \
1369         echo #define NVSIZE 16&& \
1370         echo #define NV_OVERFLOWS_INTEGERS_AT 256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*256.0*2.0&& \
1371         echo #define NVef "Qe"&& \
1372         echo #define NVff "Qf"&& \
1373         echo #define NVgf "Qg"&& \
1374         echo #undef USE_LONG_DOUBLE&& \
1375         echo #define I_QUADMATH&& \
1376         echo #define USE_QUADMATH)>> config.h
1377 else
1378         @(echo #define Gconvert^(x,n,t,b^) sprintf^(^(b^),"%%.*g",^(n^),^(x^)^)&& \
1379         echo #undef HAS_FREXPL&& \
1380         echo #undef HAS_ISNANL&& \
1381         echo #undef HAS_MODFL&& \
1382         echo #undef HAS_MODFL_PROTO&& \
1383         echo #undef HAS_SQRTL&& \
1384         echo #undef HAS_STRTOLD&& \
1385         echo #undef PERL_PRIfldbl&& \
1386         echo #undef PERL_PRIgldbl&& \
1387         echo #undef PERL_PRIeldbl&& \
1388         echo #undef PERL_SCNfldbl&& \
1389         echo #define NVTYPE double&& \
1390         echo #define NVSIZE ^8&& \
1391         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&& \
1392         echo #define NVef "e"&& \
1393         echo #define NVff "f"&& \
1394         echo #define NVgf "g"&& \
1395         echo #undef I_QUADMATH&& \
1396         echo #undef USE_QUADMATH&& \
1397         echo #undef USE_LONG_DOUBLE)>> config.h
1398 endif
1399 ifeq ($(USE_CPLUSPLUS),define)
1400         @(echo #define USE_CPLUSPLUS&& \
1401         echo #endif)>> config.h
1402 else
1403         @(echo #undef USE_CPLUSPLUS&& \
1404         echo #endif)>> config.h
1405 endif
1406 #separate line since this is sentinal that this target is done
1407         @rem. > $(MINIDIR)\.exists
1408
1409 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
1410         $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) ..\$(*F).c
1411
1412 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
1413         $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) $(*F).c
1414
1415 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
1416 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s
1417 # unless the .IF is true), so instead we use a .ELSE with the default.
1418 # This is the only file that depends on perlhost.h, vmem.h, and vdir.h
1419
1420 perllib$(o)     : perllib.c perllibst.h .\perlhost.h .\vdir.h .\vmem.h
1421 ifeq ($(USE_IMP_SYS),define)
1422         $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ $(PDBOUT) perllib.c
1423 else
1424         $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ $(PDBOUT) perllib.c
1425 endif
1426
1427 # 1. we don't want to rebuild miniperl.exe when config.h changes
1428 # 2. we don't want to rebuild miniperl.exe with non-default config.h
1429 # 3. we can't have miniperl.exe depend on git_version.h, as miniperl creates it
1430 $(MINI_OBJ)     : $(MINIDIR)\.exists $(CORE_NOCFG_H)
1431
1432 $(WIN32_OBJ)    : $(CORE_H)
1433
1434 $(CORE_OBJ)     : $(CORE_H)
1435
1436 $(DLL_OBJ)      : $(CORE_H)
1437
1438
1439 perllibst.h : $(HAVEMINIPERL) $(CONFIGPM) create_perllibst_h.pl
1440         $(MINIPERL) -I..\lib create_perllibst_h.pl
1441
1442 perldll.def : $(HAVEMINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl
1443         $(MINIPERL) -I..\lib -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
1444         $(BUILDOPT) CCTYPE=$(CCTYPE) TARG_DIR=..\ > perldll.def
1445
1446 $(PERLEXPLIB) : $(PERLIMPLIB)
1447
1448 $(PERLIMPLIB) : perldll.def
1449 ifeq ($(CCTYPE),GCC)
1450         $(IMPLIB) -k -d perldll.def -D $(PERLDLLBASE) -l $(PERLIMPLIB) -e $(PERLEXPLIB)
1451 else
1452         lib -def:perldll.def -machine:$(ARCHITECTURE) /OUT:$(PERLIMPLIB)
1453 endif
1454
1455 $(PERLDLL): $(PERLEXPLIB) $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
1456 ifeq ($(CCTYPE),GCC)
1457         $(LINK32) -shared -o $@ $(BLINK_FLAGS) \
1458            $(PERLDLL_OBJ) $(shell type Extensions_static) $(LIBFILES) $(PERLEXPLIB)
1459 else
1460         $(LINK32) -dll -out:$@ $(BLINK_FLAGS) \
1461             @Extensions_static \
1462             $(DELAYLOAD) $(LIBFILES) \
1463             $(PERLDLL_RES) $(PERLDLL_OBJ) $(PERLEXPLIB)
1464 endif
1465
1466 $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
1467 ifeq ($(CCTYPE),GCC)
1468         $(LIB32) $(LIB_FLAGS) $@ $(PERLDLL_OBJ)
1469         if exist $(STATICDIR) rmdir /s /q $(STATICDIR)
1470         for %%i in ($(shell type Extensions_static)) do \
1471                 @mkdir $(STATICDIR) && cd $(STATICDIR) && \
1472                 $(ARCHPREFIX)ar x ..\%%i && \
1473                 $(ARCHPREFIX)ar q ..\$@ *$(o) && \
1474                 cd .. && rmdir /s /q $(STATICDIR)
1475 else
1476         $(LIB32) $(LIB_FLAGS) -out:$@ @Extensions_static \
1477             $(PERLDLL_OBJ)
1478 endif
1479         $(XCOPY) $(PERLSTATICLIB) $(COREDIR)
1480
1481 $(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
1482
1483 $(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
1484
1485 $(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
1486
1487 $(BITCOUNT_H) : $(GENUUDMAP)
1488         $(GENUUDMAP) $(GENERATED_HEADERS)
1489
1490 $(GENUUDMAP) : ..\mg_raw.h
1491 ifeq ($(CCTYPE),GCC)
1492         $(LINK32) $(CFLAGS_O) -o..\generate_uudmap.exe ..\generate_uudmap.c \
1493         $(BLINK_FLAGS) $(LIBFILES)
1494 else
1495         $(CC) $(CFLAGS_O) $(PDBOUT) -Fe..\generate_uudmap.exe ..\generate_uudmap.c -link $(LIBFILES) $(BLINK_FLAGS)
1496 endif
1497
1498 .PHONY: MakePPPort
1499
1500 MakePPPort : $(HAVEMINIPERL) $(CONFIGPM)
1501         $(MINIPERL) -I..\lib ..\mkppport
1502
1503 # also known as $(HAVE_COREDIR)
1504 .coreheaders : $(CORE_H)
1505         $(XCOPY) *.h $(COREDIR)\\*.*
1506         $(RCOPY) include $(COREDIR)\\*.*
1507         $(XCOPY) ..\\*.h $(COREDIR)\\*.*
1508         rem. > $@
1509
1510 perlmain$(o) : runperl.c $(CONFIGPM)
1511         $(CC) $(subst -DPERLDLL,-UPERLDLL,$(CFLAGS_O)) $(OBJOUT_FLAG)$@ $(PDBOUT) -c runperl.c
1512
1513 perlmainst$(o) : runperl.c $(CONFIGPM)
1514         $(CC) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $(PDBOUT) -c runperl.c
1515
1516 $(PERLEXE): $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB)
1517 ifeq ($(CCTYPE),GCC)
1518         $(LINK32) -mconsole -o $@ $(BLINK_FLAGS)  \
1519             $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB) $(LIBFILES)
1520 else
1521         $(LINK32) -out:$@ $(BLINK_FLAGS) \
1522             $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB) $(LIBFILES) $(SETARGV_OBJ)
1523 endif
1524         copy $(PERLEXE) $(WPERLEXE)
1525         $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS
1526
1527 $(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES)
1528 ifeq ($(CCTYPE),GCC)
1529         $(LINK32) -mconsole -o $@ $(BLINK_FLAGS) \
1530             $(PERLEXEST_OBJ) $(PERLEXE_RES) $(PERLSTATICLIB) $(LIBFILES)
1531 else
1532         $(LINK32) -out:$@ $(BLINK_FLAGS) \
1533             $(PERLEXEST_OBJ) $(PERLEXE_RES) $(PERLSTATICLIB) $(LIBFILES) $(SETARGV_OBJ)
1534 endif
1535
1536 #-------------------------------------------------------------------------------
1537 # There's no direct way to mark a dependency on
1538 # DynaLoader.pm, so this will have to do
1539
1540 #most of deps of this target are in DYNALOADER and therefore omitted here
1541 Extensions : $(PERLDEP) $(DYNALOADER) Extension_lib $(GLOBEXE) MakePPPort
1542         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic !Unicode/Normalize
1543
1544 Normalize_static : $(CONFIGPM) $(GLOBEXE) $(HAVE_COREDIR) $(UNIDATAFILES)
1545         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static +Unicode/Normalize
1546
1547 Normalize_dyn : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) $(UNIDATAFILES)
1548         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +Unicode/Normalize
1549
1550 Extensions_reonly : $(PERLDEP) $(DYNALOADER)
1551         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
1552
1553 Exts_static_general : ..\make_ext.pl $(CONFIGPM) Extension_lib $(GLOBEXE) $(HAVE_COREDIR) MakePPPort
1554         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static !Unicode/Normalize
1555
1556 Extensions_static : list_static_libs.pl Exts_static_general $(NORMALIZE_STATIC)
1557         $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
1558
1559 Extensions_nonxs : ..\make_ext.pl ..\pod\perlfunc.pod $(CONFIGPM) $(GLOBEXE)
1560         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs !libs
1561
1562 Extension_lib : ..\make_ext.pl $(CONFIGPM)
1563         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) lib
1564
1565 #lib must be built, it can't be buildcustomize.pl-ed, and is required for XS building
1566 $(DYNALOADER) : ..\make_ext.pl $(CONFIGPM) $(HAVE_COREDIR)
1567         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(EXTDIR) --dir=$(DISTDIR) --dynaloader
1568
1569 Extensions_clean :
1570         -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=clean
1571
1572 Extensions_realclean :
1573         -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=realclean
1574
1575 # all PE files need to be built by the time this target runs, PP files can still
1576 # be running in parallel like UNIDATAFILES, this target a placeholder for the
1577 # future
1578 ifeq ($(PERLSTATIC),static)
1579 rebasePE : Extensions $(PERLDLL) $(PERLEXE) $(PERLEXESTATIC)
1580 else
1581 rebasePE : Extensions $(PERLDLL) $(NORMALIZE_DYN) $(PERLEXE)
1582 endif
1583         $(NOOP)
1584
1585 #-------------------------------------------------------------------------------
1586
1587 doc: $(PERLEXE) $(PERLDLL) ..\pod\perltoc.pod
1588         $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
1589             --podpath=pod:lib:utils --htmlroot="file://$(subst :,|,$(INST_HTML))"\
1590             --recurse
1591
1592 ..\utils\Makefile: $(CONFIGPM) ..\utils\Makefile.PL
1593         $(MINIPERL) -I..\lib ..\utils\Makefile.PL ..
1594
1595 # Note that this next section is parsed (and regenerated) by pod/buildtoc
1596 # so please check that script before making structural changes here
1597 utils: $(HAVEMINIPERL) ..\utils\Makefile
1598         cd ..\utils && $(PLMAKE) PERL=$(MINIPERL)
1599         copy ..\README.aix      ..\pod\perlaix.pod
1600         copy ..\README.amiga    ..\pod\perlamiga.pod
1601         copy ..\README.android  ..\pod\perlandroid.pod
1602         copy ..\README.bs2000   ..\pod\perlbs2000.pod
1603         copy ..\README.cn       ..\pod\perlcn.pod
1604         copy ..\README.cygwin   ..\pod\perlcygwin.pod
1605         copy ..\README.freebsd  ..\pod\perlfreebsd.pod
1606         copy ..\README.haiku    ..\pod\perlhaiku.pod
1607         copy ..\README.hpux     ..\pod\perlhpux.pod
1608         copy ..\README.hurd     ..\pod\perlhurd.pod
1609         copy ..\README.irix     ..\pod\perlirix.pod
1610         copy ..\README.jp       ..\pod\perljp.pod
1611         copy ..\README.ko       ..\pod\perlko.pod
1612         copy ..\README.linux    ..\pod\perllinux.pod
1613         copy ..\README.macos    ..\pod\perlmacos.pod
1614         copy ..\README.macosx   ..\pod\perlmacosx.pod
1615         copy ..\README.openbsd  ..\pod\perlopenbsd.pod
1616         copy ..\README.os2      ..\pod\perlos2.pod
1617         copy ..\README.os390    ..\pod\perlos390.pod
1618         copy ..\README.os400    ..\pod\perlos400.pod
1619         copy ..\README.plan9    ..\pod\perlplan9.pod
1620         copy ..\README.qnx      ..\pod\perlqnx.pod
1621         copy ..\README.riscos   ..\pod\perlriscos.pod
1622         copy ..\README.solaris  ..\pod\perlsolaris.pod
1623         copy ..\README.synology ..\pod\perlsynology.pod
1624         copy ..\README.tru64    ..\pod\perltru64.pod
1625         copy ..\README.tw       ..\pod\perltw.pod
1626         copy ..\README.vos      ..\pod\perlvos.pod
1627         copy ..\README.win32    ..\pod\perlwin32.pod
1628         copy ..\pod\perldelta.pod ..\pod\perl5358delta.pod
1629         $(MINIPERL) -I..\lib $(PL2BAT) $(UTILS)
1630         $(MINIPERL) -I..\lib ..\autodoc.pl ..
1631         $(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
1632
1633 ..\pod\perltoc.pod: $(PERLEXE) $(PERLDLL) Extensions Extensions_nonxs $(NORMALIZE_DYN) utils
1634         $(PERLEXE) -f ..\pod\buildtoc -q
1635
1636 # Note that the pod cleanup in this next section is parsed (and regenerated
1637 # by pod/buildtoc so please check that script before making changes here
1638
1639 distclean: realclean
1640         -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
1641                 $(PERLIMPLIB) ..\miniperl$(a) $(PERLEXESTATIC) $(PERLSTATICLIB)
1642         -del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm
1643         -del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm
1644         -del /f $(LIBDIR)\.exists $(LIBDIR)\attributes.pm $(LIBDIR)\DynaLoader.pm
1645         -del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
1646         -del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm
1647         -del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
1648         -del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm $(LIBDIR)\re.pm
1649         -del /f $(LIBDIR)\File\Glob.pm
1650         -del /f $(LIBDIR)\Sys\Hostname.pm
1651         -del /f $(LIBDIR)\Time\HiRes.pm
1652         -del /f $(LIBDIR)\Unicode\Normalize.pm
1653         -del /f $(LIBDIR)\Math\BigInt\FastCalc.pm
1654         -del /f $(LIBDIR)\Storable.pm $(LIBDIR)\Storable\Limit.pm
1655         -del /f $(LIBDIR)\Win32.pm
1656         -del /f $(LIBDIR)\Win32CORE.pm
1657         -del /f $(LIBDIR)\Win32API\File.pm
1658         -del /f $(LIBDIR)\Win32API\File\cFile.pc
1659         -del /f $(LIBDIR)\buildcustomize.pl
1660         -del /f $(DISTDIR)\XSLoader\XSLoader.pm
1661         -del /f *.def *.map
1662         -if exist $(LIBDIR)\Amiga rmdir /s /q $(LIBDIR)\Amiga
1663         -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App
1664         -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive
1665         -if exist $(LIBDIR)\Attribute rmdir /s /q $(LIBDIR)\Attribute
1666         -if exist $(LIBDIR)\autodie rmdir /s /q $(LIBDIR)\autodie
1667         -if exist $(LIBDIR)\Carp rmdir /s /q $(LIBDIR)\Carp
1668         -if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress
1669         -if exist $(LIBDIR)\Config\Perl rmdir /s /q $(LIBDIR)\Config\Perl
1670         -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN
1671         -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
1672         -if exist $(LIBDIR)\Devel rmdir /s /q $(LIBDIR)\Devel
1673         -if exist $(LIBDIR)\Digest rmdir /s /q $(LIBDIR)\Digest
1674         -if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode
1675         -if exist $(LIBDIR)\encoding rmdir /s /q $(LIBDIR)\encoding
1676         -if exist $(LIBDIR)\Exporter rmdir /s /q $(LIBDIR)\Exporter
1677         -if exist $(LIBDIR)\ExtUtils\CBuilder rmdir /s /q $(LIBDIR)\ExtUtils\CBuilder
1678         -if exist $(LIBDIR)\ExtUtils\Command rmdir /s /q $(LIBDIR)\ExtUtils\Command
1679         -if exist $(LIBDIR)\ExtUtils\Constant rmdir /s /q $(LIBDIR)\ExtUtils\Constant
1680         -if exist $(LIBDIR)\ExtUtils\Liblist rmdir /s /q $(LIBDIR)\ExtUtils\Liblist
1681         -if exist $(LIBDIR)\ExtUtils\MakeMaker rmdir /s /q $(LIBDIR)\ExtUtils\MakeMaker
1682         -if exist $(LIBDIR)\ExtUtils\ParseXS rmdir /s /q $(LIBDIR)\ExtUtils\ParseXS
1683         -if exist $(LIBDIR)\ExtUtils\Typemaps rmdir /s /q $(LIBDIR)\ExtUtils\Typemaps
1684         -if exist $(LIBDIR)\File\Spec rmdir /s /q $(LIBDIR)\File\Spec
1685         -if exist $(LIBDIR)\Filter rmdir /s /q $(LIBDIR)\Filter
1686         -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash
1687         -if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP
1688         -if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N
1689         -if exist $(LIBDIR)\inc rmdir /s /q $(LIBDIR)\inc
1690         -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
1691         -if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC
1692         -if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON
1693         -if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List
1694         -if exist $(LIBDIR)\Locale rmdir /s /q $(LIBDIR)\Locale
1695         -if exist $(LIBDIR)\Math rmdir /s /q $(LIBDIR)\Math
1696         -if exist $(LIBDIR)\Memoize rmdir /s /q $(LIBDIR)\Memoize
1697         -if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME
1698         -if exist $(LIBDIR)\Module rmdir /s /q $(LIBDIR)\Module
1699         -if exist $(LIBDIR)\Net\FTP rmdir /s /q $(LIBDIR)\Net\FTP
1700         -if exist $(LIBDIR)\Params rmdir /s /q $(LIBDIR)\Params
1701         -if exist $(LIBDIR)\Parse rmdir /s /q $(LIBDIR)\Parse
1702         -if exist $(LIBDIR)\Perl rmdir /s /q $(LIBDIR)\Perl
1703         -if exist $(LIBDIR)\PerlIO rmdir /s /q $(LIBDIR)\PerlIO
1704         -if exist $(LIBDIR)\Pod\Html rmdir /s /q $(LIBDIR)\Pod\Html
1705         -if exist $(LIBDIR)\Pod\Perldoc rmdir /s /q $(LIBDIR)\Pod\Perldoc
1706         -if exist $(LIBDIR)\Pod\Simple rmdir /s /q $(LIBDIR)\Pod\Simple
1707         -if exist $(LIBDIR)\Pod\Text rmdir /s /q $(LIBDIR)\Pod\Text
1708         -if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar
1709         -if exist $(LIBDIR)\Search rmdir /s /q $(LIBDIR)\Search
1710         -if exist $(LIBDIR)\Sub rmdir /s /q $(LIBDIR)\Sub
1711         -if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys
1712         -if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP
1713         -if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term
1714         -if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
1715         -if exist $(LIBDIR)\Test2 rmdir /s /q $(LIBDIR)\Test2
1716         -if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text
1717         -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
1718         -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
1719         -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash
1720         -if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate
1721         -if exist $(LIBDIR)\Unicode\Collate\Locale rmdir /s /q $(LIBDIR)\Unicode\Collate\Locale
1722         -if exist $(LIBDIR)\version rmdir /s /q $(LIBDIR)\version
1723         -if exist $(LIBDIR)\VMS rmdir /s /q $(LIBDIR)\VMS
1724         -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
1725         -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
1726         -cd $(PODDIR) && del /f *.html *.bat roffitall \
1727             perl5358delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
1728             perlapi.pod perlbs2000.pod perlcn.pod perlcygwin.pod \
1729             perlfreebsd.pod perlhaiku.pod perlhpux.pod perlhurd.pod \
1730             perlintern.pod perlirix.pod perljp.pod perlko.pod perllinux.pod \
1731             perlmacos.pod perlmacosx.pod perlmodlib.pod perlopenbsd.pod \
1732             perlos2.pod perlos390.pod perlos400.pod perlplan9.pod \
1733             perlqnx.pod perlriscos.pod perlsolaris.pod perlsynology.pod \
1734             perltoc.pod perltru64.pod perltw.pod perluniprops.pod \
1735             perlvos.pod perlwin32.pod
1736         -cd ..\utils && del /f h2ph splain perlbug pl2pm h2xs \
1737             perldoc perlivp libnetcfg enc2xs encguess piconv cpan *.bat \
1738             xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
1739         -del /f ..\config.sh perlmain.c dlutils.c config.h.new \
1740             perlmainst.c
1741         -del /f $(CONFIGPM)
1742         -del /f ..\lib\Config_git.pl
1743         -del /f "bin\*.bat"
1744         -del /f perllibst.h
1745         -del /f $(PERLEXE_RES) perl.base
1746         -cd .. && del /s *$(a) *.map *.pdb *.ilk *.bs *$(o) .exists pm_to_blib ppport.h
1747         -cd $(EXTDIR) && del /s *.def Makefile Makefile.old
1748         -cd $(DISTDIR) && del /s *.def Makefile Makefile.old
1749         -cd $(CPANDIR) && del /s *.def Makefile Makefile.old
1750         -del /s ..\utils\Makefile
1751         -if exist $(AUTODIR) rmdir /s /q $(AUTODIR)
1752         -if exist $(COREDIR) rmdir /s /q $(COREDIR)
1753         -if exist pod2htmd.tmp del pod2htmd.tmp
1754         -if exist $(HTMLDIR) rmdir /s /q $(HTMLDIR)
1755         -del /f ..\t\test_state
1756
1757 install : all installbare installhtml
1758
1759 installbare : utils ..\pod\perltoc.pod
1760         $(PERLEXE) ..\installperl
1761         if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\$(NULL)
1762         if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\$(NULL)
1763         $(XCOPY) $(GLOBEXE) $(INST_BIN)\$(NULL)
1764         if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\$(NULL)
1765         $(XCOPY) "bin\*.bat" $(INST_SCRIPT)\$(NULL)
1766
1767 installhtml : doc
1768         $(RCOPY) $(HTMLDIR)\*.* $(INST_HTML)\$(NULL)
1769
1770 inst_lib : $(CONFIGPM)
1771         $(RCOPY) ..\lib $(INST_LIB)\$(NULL)
1772
1773 $(UNIDATAFILES) : ..\pod\perluniprops.pod
1774
1775 ..\pod\perluniprops.pod: ..\lib\unicore\mktables $(CONFIGPM)
1776         $(MINIPERL) -I..\lib ..\lib\unicore\mktables -C ..\lib\unicore -P ..\pod -maketest -makelist -p
1777
1778 minitest : $(HAVEMINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
1779         $(XCOPY) $(MINIPERL) ..\t\$(NULL)
1780         if exist ..\t\perl.exe del /f ..\t\perl.exe
1781         rename ..\t\miniperl.exe perl.exe
1782         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1783         attrib -r "..\t\*.*"
1784         cd ..\t && \
1785         $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
1786
1787 test-prep : all utils ..\pod\perltoc.pod $(TESTPREPGCC)
1788         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1789         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1790         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1791 # If building with gcc versions 4.x.x or greater, then
1792 # the GCC helper DLL will also need copied to the test directory.
1793 # The name of the dll can change, depending upon which vendor has supplied
1794 # your compiler, and upon the values of "x".
1795 # libstdc++-6.dll is copied if it exists as it, too, may then be needed.
1796 # Without this copying, the op/taint.t test script will fail.
1797
1798 ifeq ($(CCTYPE),GCC)
1799
1800 test-prep-gcc :
1801         if exist $(CCDLLDIR)\libgcc_s_seh-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_seh-1.dll ..\t\$(NULL)
1802         if exist $(CCDLLDIR)\libgcc_s_sjlj-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_sjlj-1.dll ..\t\$(NULL)
1803         if exist $(CCDLLDIR)\libgcc_s_dw2-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_dw2-1.dll ..\t\$(NULL)
1804         if exist $(CCDLLDIR)\libstdc++-6.dll $(XCOPY) $(CCDLLDIR)\libstdc++-6.dll ..\t\$(NULL)
1805         if exist $(CCDLLDIR)\libwinpthread-1.dll $(XCOPY) $(CCDLLDIR)\libwinpthread-1.dll ..\t\$(NULL)
1806         if exist $(CCDLLDIR)\libquadmath-0.dll $(XCOPY) $(CCDLLDIR)\libquadmath-0.dll ..\t\$(NULL)
1807
1808 endif
1809
1810 test : test-prep
1811         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1812             cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
1813
1814 test_porting : test-prep
1815         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1816             cd ..\t && perl.exe harness $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
1817
1818 test-reonly : reonly utils
1819         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1820         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1821         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1822         cd ..\t && perl.exe harness $(OPT) -re \bpat\\/ $(EXTRA)
1823
1824 regen :
1825         cd .. && regen.pl
1826
1827 test-notty : test-prep
1828         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1829             set PERL_SKIP_TTY_TEST=1 && \
1830             cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
1831
1832 _test :
1833         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1834         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1835         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1836         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1837             cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
1838
1839 _clean :
1840         -@erase miniperlmain$(o)
1841         -@erase $(MINIPERL)
1842         -@erase perlglob$(o)
1843         -@erase perlmain$(o)
1844         -@erase perlmainst$(o)
1845         -@erase /f config.h
1846         -@erase /f ..\git_version.h
1847         -@erase $(GLOBEXE)
1848         -@erase $(PERLEXE)
1849         -@erase $(WPERLEXE)
1850         -@erase $(PERLEXESTATIC)
1851         -@erase $(PERLSTATICLIB)
1852         -@erase $(PERLDLL)
1853         -@erase $(CORE_OBJ)
1854         -@erase $(GENUUDMAP) $(GENUUDMAP_OBJ) $(GENERATED_HEADERS)
1855         -@erase .coreheaders
1856         -if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
1857         -if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1)
1858         -if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)
1859         -@erase $(UNIDATAFILES)
1860         -@erase $(WIN32_OBJ)
1861         -@erase $(DLL_OBJ)
1862         -@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp *.res
1863         -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
1864         -@erase *.ilk
1865         -@erase *.pdb ..\*.pdb
1866         -@erase Extensions_static
1867
1868 clean : Extensions_clean _clean
1869
1870 realclean : Extensions_realclean _clean
1871
1872 # Handy way to run perlbug -ok without having to install and run the
1873 # installed perlbug. We don't re-run the tests here - we trust the user.
1874 # Please *don't* use this unless all tests pass.
1875 # If you want to report test failures, use "gmake nok" instead.
1876 ok: utils $(PERLEXE) $(PERLDLL) Extensions_nonxs Extensions
1877         $(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)"
1878
1879 okfile: utils $(PERLEXE) $(PERLDLL) Extensions_nonxs Extensions
1880         $(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
1881
1882 nok: utils $(PERLEXE) $(PERLDLL) Extensions_nonxs Extensions
1883         $(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)"
1884
1885 nokfile: utils $(PERLEXE) $(PERLDLL) Extensions_nonxs Extensions
1886         $(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok
1887