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