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