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