# Makefile to build perl on Windows using DMAKE.
# Supported compilers:
# Microsoft Visual C++ 6.0 or later
-# MinGW with gcc-3.4.5 or later
+# MinGW with gcc-3.4.5 or later with runtime < 3.21
+# MinGW64 with gcc-4.4.3 or later
# Windows SDK 64-bit compiler and tools
#
# This is set up to build a perl.exe that runs off a shared library
-# (perl528.dll). Also makes individual DLLs for the XS extensions.
+# (perl531.dll). Also makes individual DLLs for the XS extensions.
#
##
# versioned installation can be obtained by setting INST_TOP above to a
# path that includes an arbitrary version string.
#
-#INST_VER *= \5.28.0
+#INST_VER *= \5.31.4
#
# Comment this out if you DON'T want your perl installation to have
#CCTYPE *= MSVC70
# Visual C++ Toolkit 2003 (aka Visual C++ 7.1) (free command-line tools)
#CCTYPE *= MSVC70FREE
-# Windows Server 2003 SP1 Platform SDK (April 2005)
+# Windows Server 2003 SP1 Platform SDK (April 2005) (64-bit compiler and tools)
#CCTYPE = SDK2003SP1
# Visual C++ 2005 (aka Visual C++ 8.0) (full version or Express Edition)
#CCTYPE *= MSVC80
#CCTYPE = MSVC140
# Visual C++ 2017 (aka Visual C++ 14.1) (full version or Community Edition)
#CCTYPE = MSVC141
+# Visual C++ 2019 (aka Visual C++ 14.2) (full version or Community Edition)
+#CCTYPE = MSVC142
# MinGW or mingw-w64 with gcc-3.4.5 or later
#CCTYPE = GCC
# set this to additionally provide a statically linked perl-static.exe.
# Note that dynamic loading will not work with this perl, so you must
# include required modules statically using the STATIC_EXT or ALL_STATIC
-# variables below. A static library perl528s.lib will also be created.
+# variables below. A static library perl531s.lib will also be created.
# Ordinary perl.exe is not affected by this option.
#
#BUILD_STATIC *= define
# Running VCVARS32.BAT, VCVARSALL.BAT or similar is *required* when using
# Visual C++.
#
+# For GCC builds this should be the directory containing the bin, include,
+# lib directories for your compiler.
+#
#CCHOME *= C:\MinGW
BUILDOPT += -DWIN32_NO_REGISTRY
.ENDIF
+.IF "$(CCTYPE)" == "GCC"
+GCCTARGET := $(shell gcc -dumpmachine & exit /b 0)
+.ENDIF
+
#no explicit CCTYPE given, do auto detection
.IF "$(CCTYPE)" == ""
-GCCTARGET *= $(shell gcc -dumpmachine 2>NUL & exit /b 0)
+GCCTARGET := $(shell gcc -dumpmachine 2>NUL & exit /b 0)
#do we have a GCC?
.IF "$(GCCTARGET)" != ""
CCTYPE = GCC
.ELSE
+WIN64 := $(shell for /f "tokens=3 delims=.^ " \
+ %i in ('cl ^2^>^&1') do @if "%i" == "32-bit" echo undef)
+#major version of CL has diff position based on 32 vs 64
+#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
+#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
#use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output
-MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \
- %i in ('cl ^2^>^&1') do @if not defined MSVCVER set /A "MSVCVER=%i-6"))
-CCTYPE := MSVC$(MSVCVER)0
+.IF "$(WIN64)" == "undef"
+MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \
+ %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \
+ (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \
+ else (set /A "MSVCVER=(%i-6)*10")))
+.ELSE
+MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \
+ %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \
+ (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \
+ else (set /A "MSVCVER=(%i-6)*10")))
+.ENDIF
+#autodetect failed, reset to empty string
+.IF "$(MSVCVER)" == "-50"
+CCTYPE :=
+.ELSE
+CCTYPE := MSVC$(MSVCVER)
+.ENDIF
.ENDIF
.ENDIF
.ELIF "$(CCTYPE)" == "MSVC60" || \
"$(CCTYPE)" == "MSVC70" || "$(CCTYPE)" == "MSVC70FREE"
CCHOME *= $(MSVCDir)
-.ELIF "$(CCTYPE)" == "MSVC141"
+.ELIF "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
CCHOME *= $(VCToolsInstallDir)
.ELSE
CCHOME *= $(VCINSTALLDIR)
CCLIBDIR *= $(CCHOME)\lib
.ELSE
CCINCDIR *= $(CCHOME)\include
-.IF "$(CCTYPE)" == "MSVC141"
+.IF "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
.IF "$(WIN64)" == "define"
CCLIBDIR *= $(CCHOME)\lib\x64
.ELSE
MINIBUILDOPT += -D__USE_MINGW_ANSI_STDIO
.ENDIF
-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))
+GCCVER1:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %i)
+GCCVER2:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %j)
+GCCVER3:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %k)
+
+# If you are using GCC, 4.3 or later by default we add the -fwrapv option.
+# See https://rt.perl.org/Ticket/Display.html?id=121505
+#
+GCCWRAPV *= $(shell if "$(GCCVER1)"=="4" (if "$(GCCVER2)" geq "3" echo define) else if "$(GCCVER1)" geq "5" (echo define))
.IF "$(GCCWRAPV)" == "define"
BUILDOPT += -fwrapv
LOCDEFS = -DPERLDLL -DPERL_CORE
CXX_FLAG = -TP -EHsc
-.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
LIBC = ucrt.lib
.ELSE
LIBC = msvcrt.lib
OPTIMIZE = -Od -MD -Zi
LINK_DBG = -debug
.ELIF "$(CFG)" == "DebugFull"
-.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
LIBC = ucrtd.lib
.ELSE
LIBC = msvcrtd.lib
.ENDIF
# Likewise for deprecated Winsock APIs in VC++ 14.0 onwards for now.
-.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
DEFINES += -D_WINSOCK_DEPRECATED_NO_WARNINGS
.ENDIF
+# The Windows Server 2003 SP1 SDK compiler only defines _configthreadlocale() if
+# _MT is defined, i.e. when using /MT (the LIBCMT.lib version of the CRT), which
+# the perl build doesn't use. We therefore specify NO_THREAD_SAFE_LOCALE so that
+# perl.h doesn't set USE_THREAD_SAFE_LOCALE, which it otherwise would do since
+# _MSC_VER is 1400 for this compiler (as per MSVC80).
+.IF "$(CCTYPE)" == "SDK2003SP1"
+DEFINES += -DNO_THREAD_SAFE_LOCALE
+.ENDIF
+
# In VS 2005 (VC++ 8.0) Microsoft changes time_t from 32-bit to
# 64-bit, even in 32-bit mode. It also provides the _USE_32BIT_TIME_T
# preprocessor option to revert back to the old functionality for
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib \
odbc32.lib odbccp32.lib comctl32.lib
-.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
.IF "$(CFG)" == "DebugFull"
LIBBASEFILES += msvcrtd.lib vcruntimed.lib
.ELSE
LIBBASEFILES += libircmt.lib libmmd.lib
.ENDIF
-# The 64 bit Windows Server 2003 SP1 SDK compilers link against MSVCRT.dll, which
+# The Windows Server 2003 SP1 SDK compiler links against MSVCRT.dll, which
# doesn't include the buffer overrun verification code used by the /GS switch.
# Since the code links against libraries that are compiled with /GS, this
# "security cookie verification" code must be included via bufferoverflow.lib.
-.IF "$(WIN64)" == "define" && "$(CCTYPE)" == "SDK2003SP1"
+.IF "$(CCTYPE)" == "SDK2003SP1"
LIBBASEFILES += bufferoverflowU.lib
.ENDIF
# LINK_FLAGS else subsystem is only needed for EXE building, not XS DLL building
# Console vs GUI makes no difference for DLLs, so use default for cleaner
# building cmd lines
-.IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140"
+.IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
.IF "$(WIN64)" == "define"
LINK_FLAGS += -subsystem:console,"5.02"
.ELSE
CFGSH_TMPL = config.gc
CFGH_TMPL = config_H.gc
-PERLIMPLIB = $(COREDIR)\libperl528$(a)
-PERLSTATICLIB = ..\libperl528s$(a)
+PERLIMPLIB = $(COREDIR)\libperl531$(a)
+PERLSTATICLIB = ..\libperl531s$(a)
INT64 = long long
.ELSE
# makedef.pl must be updated if this changes, and this should normally
# only change when there is an incompatible revision of the public API.
-PERLIMPLIB *= $(COREDIR)\perl528$(a)
-PERLEXPLIB *= $(COREDIR)\perl528.exp
-PERLSTATICLIB *= ..\perl528s$(a)
-PERLDLL = ..\perl528.dll
-PERLDLLBASE = perl528.dll
+PERLIMPLIB *= $(COREDIR)\perl531$(a)
+PERLEXPLIB *= $(COREDIR)\perl531.exp
+PERLSTATICLIB *= ..\perl531s$(a)
+PERLDLL = ..\perl531.dll
+PERLDLLBASE = perl531.dll
#EUMM on Win32 isn't ready for parallel make, so only allow this file to be parallel
#$(MAKE) will contain the -P that this makefile was called with, which is bad for
# Top targets
#
-all : CHECKDMAKE rebasePE Extensions_nonxs $(PERLSTATIC) PostExt
+all : CHECKDMAKE rebasePE Extensions_nonxs $(PERLSTATIC)
+
+info :
+.IF "$(CCTYPE)" == "GCC"
+ @echo # CCTYPE=$(CCTYPE)&& \
+ echo # CC=$(CC)&& \
+ echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \
+ echo # GCCTARGET=$(GCCTARGET)&& \
+ echo # GCCCROSS=$(GCCCROSS)&& \
+ echo # WIN64=$(WIN64)&& \
+ echo # ARCHITECTURE=$(ARCHITECTURE)&& \
+ echo # ARCHNAME=$(ARCHNAME)&& \
+ echo # MAKE=$(PLMAKE)
+.ELSE
+ @echo # CCTYPE=$(CCTYPE)&& \
+ echo # WIN64=$(WIN64)&& \
+ echo # ARCHITECTURE=$(ARCHITECTURE)&& \
+ echo # ARCHNAME=$(ARCHNAME)&& \
+ echo # MAKE=$(PLMAKE)
+.ENDIF
+.IF "$(CCTYPE)" == ""
+ @echo Unable to detect gcc and/or architecture!
+ @exit 1
+.ENDIF
+
..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h
echo #undef NVgf&& \
echo #undef USE_LONG_DOUBLE&& \
echo #undef USE_CPLUSPLUS)>> config.h
-.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
@(echo #undef FILE_ptr&& \
echo #undef FILE_cnt&& \
echo #undef FILE_base&& \
echo #endif)>> config.h
.ENDIF
#separate line since this is sentinal that this target is done
- rem. > $(MINIDIR)\.exists
+ @rem. > $(MINIDIR)\.exists
$(MINICORE_OBJ) : $(CORE_NOCFG_H)
$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) ..\$(*B).c
.ENDIF
$(NOOP)
-PostExt : ..\lib\Storable\Limit.pm
- $(NOOP)
-
-# we need the exe, perl(ver).dll, and the Exporter, Storable, Win32 extensions
-# rebasePE most of that, including adjustment for static builds, so we
-# just need non-xs extensions
-..\lib\Storable\Limit.pm : rebasePE Extensions_nonxs
- cd ..\dist\Storable && $(MAKE) lib\Storable\Limit.pm
- if not exist ..\lib\Storable mkdir ..\lib\Storable
- copy ..\dist\Storable\lib\Storable\Limit.pm ..\lib\Storable\Limit.pm
-
#-------------------------------------------------------------------------------
copy ..\README.amiga ..\pod\perlamiga.pod
copy ..\README.android ..\pod\perlandroid.pod
copy ..\README.bs2000 ..\pod\perlbs2000.pod
- copy ..\README.ce ..\pod\perlce.pod
copy ..\README.cn ..\pod\perlcn.pod
copy ..\README.cygwin ..\pod\perlcygwin.pod
copy ..\README.dos ..\pod\perldos.pod
copy ..\README.tw ..\pod\perltw.pod
copy ..\README.vos ..\pod\perlvos.pod
copy ..\README.win32 ..\pod\perlwin32.pod
- copy ..\pod\perldelta.pod ..\pod\perl5280delta.pod
+ copy ..\pod\perldelta.pod ..\pod\perl5315delta.pod
$(MINIPERL) -I..\lib $(PL2BAT) $(UTILS)
$(MINIPERL) -I..\lib ..\autodoc.pl ..
$(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
-del /f $(LIBDIR)\Time\HiRes.pm
-del /f $(LIBDIR)\Unicode\Normalize.pm
-del /f $(LIBDIR)\Math\BigInt\FastCalc.pm
- -del /f $(LIBDIR)\Storable.pm $(LIBDIR)\Storable\Limit.pm
+ -del /f $(LIBDIR)\Storable.pm
-del /f $(LIBDIR)\Win32.pm
-del /f $(LIBDIR)\Win32CORE.pm
-del /f $(LIBDIR)\Win32API\File.pm
-if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
-if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
-cd $(PODDIR) && del /f *.html *.bat roffitall \
- perl5280delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
- perlapi.pod perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
+ perl5315delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
+ perlapi.pod perlbs2000.pod perlcn.pod perlcygwin.pod \
perldos.pod perlfreebsd.pod perlhaiku.pod perlhpux.pod \
perlhurd.pod perlintern.pod perlirix.pod perljp.pod perlko.pod \
perllinux.pod perlmacos.pod perlmacosx.pod perlmodlib.pod \