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