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