This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deparse.pm: handle optimised-away keys() better
[perl5.git] / win32 / Makefile
index f6d8fb5..6983689 100644 (file)
@@ -5,7 +5,7 @@
 #      Windows SDK 64-bit compiler and tools
 #
 # This is set up to build a perl.exe that runs off a shared library
-# (perl523.dll).  Also makes individual DLLs for the XS extensions.
+# (perl527.dll).  Also makes individual DLLs for the XS extensions.
 #
 
 ##
@@ -38,7 +38,7 @@ INST_TOP      = $(INST_DRV)\perl
 # versioned installation can be obtained by setting INST_TOP above to a
 # path that includes an arbitrary version string.
 #
-#INST_VER      = \5.23.3
+#INST_VER      = \5.27.7
 
 #
 # Comment this out if you DON'T want your perl installation to have
@@ -96,6 +96,19 @@ USE_LARGE_FILES      = define
 #USE_64_BIT_INT        = define
 
 #
+# Comment this out if you want the legacy default behavior of including '.' at
+# the end of @INC.
+#
+DEFAULT_INC_EXCLUDES_DOT = define
+
+#
+# Uncomment this if you want to disable looking up values from
+# HKEY_CURRENT_USER\Software\Perl and HKEY_LOCAL_MACHINE\Software\Perl in
+# the Registry.
+#
+#USE_NO_REGISTRY = define
+
+#
 # uncomment exactly one of the following
 #
 # Visual C++ 6.0 (aka Visual C++ 98)
@@ -106,26 +119,20 @@ CCTYPE            = MSVC60
 #CCTYPE                = MSVC70FREE
 # Windows Server 2003 SP1 Platform SDK (April 2005)
 #CCTYPE                = SDK2003SP1
-# Visual C++ 2005 (aka Visual C++ 8.0) (full version)
+# Visual C++ 2005 (aka Visual C++ 8.0) (full version or Express Edition)
 #CCTYPE                = MSVC80
-# Visual C++ 2005 Express Edition (aka Visual C++ 8.0) (free version)
-#CCTYPE                = MSVC80FREE
-# Visual C++ 2008 (aka Visual C++ 9.0) (full version)
+# Visual C++ 2008 (aka Visual C++ 9.0) (full version or Express Edition)
 #CCTYPE                = MSVC90
-# Visual C++ 2008 Express Edition (aka Visual C++ 9.0) (free version)
-#CCTYPE                = MSVC90FREE
-# Visual C++ 2010 (aka Visual C++ 10.0) (full version)
+# Visual C++ 2010 (aka Visual C++ 10.0) (full version or Express Edition)
 #CCTYPE                = MSVC100
-# Visual C++ 2010 Express Edition (aka Visual C++ 10.0) (free version)
-#CCTYPE                = MSVC100FREE
-# Visual C++ 2012 (aka Visual C++ 11.0) (full version)
+# Visual C++ 2012 (aka Visual C++ 11.0) (full version or Express Edition)
 #CCTYPE                = MSVC110
-# Visual C++ 2012 Express Edition (aka Visual C++ 11.0) (free version)
-#CCTYPE                = MSVC110FREE
-# Visual C++ 2013 (aka Visual C++ 12.0) (full version)
+# Visual C++ 2013 (aka Visual C++ 12.0) (full version or Express Edition)
 #CCTYPE                = MSVC120
-# Visual C++ 2013 Express Edition (aka Visual C++ 12.0) (free version)
-#CCTYPE                = MSVC120FREE
+# Visual C++ 2015 (aka Visual C++ 14.0) (full version or Express Edition)
+#CCTYPE                = MSVC140
+# Visual C++ 2017 (aka Visual C++ 14.1) (full version or Community Edition)
+#CCTYPE                = MSVC141
 
 #
 # If you are using Intel C++ Compiler uncomment this
@@ -185,7 +192,7 @@ CCTYPE              = MSVC60
 # 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 perl523s.lib will also be created.
+# variables below. A static library perl527s.lib will also be created.
 # Ordinary perl.exe is not affected by this option.
 #
 #BUILD_STATIC  = define
@@ -200,16 +207,23 @@ CCTYPE            = MSVC60
 #ALL_STATIC    = define
 
 #
+# set the install location of the compiler
+# Running VCVARS32.BAT, VCVARSALL.BAT or similar is *required* when using
+# Visual C++.
+# Versions of Visual C++ up to VC++ 7.1 define $(MSVCDir); versions since then
+# define $(VCINSTALLDIR) instead, but for VC++ 14.1 we need the subfolder given
+# by $(VCToolsInstallDir).
 #
-# set the install locations of the compiler include/libraries
-# Running VCVARS32.BAT is *required* when using Visual C.
-# Some versions of Visual C don't define MSVCDIR in the environment,
-# so you may have to set CCHOME explicitly (spaces in the path name should
-# not be quoted)
-#
+!IF "$(CCTYPE)" == "MSVC60" || \
+    "$(CCTYPE)" == "MSVC70" || "$(CCTYPE)" == "MSVC70FREE"
 CCHOME         = $(MSVCDIR)
-CCINCDIR       = $(CCHOME)\include
-CCLIBDIR       = $(CCHOME)\lib
+!ELSE
+!  IF "$(CCTYPE)" == "MSVC141"
+CCHOME         = $(VCTOOLSINSTALLDIR)
+!  ELSE
+CCHOME         = $(VCINSTALLDIR)
+!  ENDIF
+!ENDIF
 
 #
 # Additional compiler flags can be specified here.
@@ -294,6 +308,14 @@ USE_LARGE_FILES    = undef
 USE_64_BIT_INT = undef
 !ENDIF
 
+!IF "$(DEFAULT_INC_EXCLUDES_DOT)" == ""
+DEFAULT_INC_EXCLUDES_DOT = undef
+!ENDIF
+
+!IF "$(USE_NO_REGISTRY)" == ""
+USE_NO_REGISTRY        = undef
+!ENDIF
+
 !IF "$(USE_IMP_SYS)$(USE_MULTI)" == "defineundef"
 USE_MULTI      = define
 !ENDIF
@@ -314,6 +336,10 @@ BUILDOPT   = $(BUILDOPT) -DPERL_IMPLICIT_CONTEXT
 BUILDOPT       = $(BUILDOPT) -DPERL_IMPLICIT_SYS
 !ENDIF
 
+!IF "$(USE_NO_REGISTRY)" != "undef"
+BUILDOPT       = $(BUILDOPT) -DWIN32_NO_REGISTRY
+!ENDIF
+
 !IF "$(PROCESSOR_ARCHITECTURE)" == ""
 PROCESSOR_ARCHITECTURE = x86
 !ENDIF
@@ -388,7 +414,16 @@ ARCHNAME   = $(ARCHNAME)-64int
 # All but the free version of VC++ 7.1 can load DLLs on demand.  Makes the test
 # suite run in about 10% less time.
 !IF "$(CCTYPE)" != "MSVC70FREE"
+# If no registry, advapi32 is only used for Perl_pp_getlogin/getlogin/GetUserNameA
+# which is rare to execute
+!IF "$(USE_NO_REGISTRY)" != "undef"
+DELAYLOAD      = -DELAYLOAD:ws2_32.dll -DELAYLOAD:advapi32.dll delayimp.lib
+MINIDELAYLOAD  =
+!ELSE
 DELAYLOAD      = -DELAYLOAD:ws2_32.dll delayimp.lib
+#miniperl never does any registry lookups
+MINIDELAYLOAD  = -DELAYLOAD:advapi32.dll
+!ENDIF
 !ENDIF
 
 # Visual C++ 2005 and 2008 (VC++ 8.0 and 9.0) create manifest files for EXEs and
@@ -401,6 +436,19 @@ EMBED_EXE_MANI     = if exist $@.manifest mt -nologo -manifest $@.manifest -outputre
 EMBED_DLL_MANI = if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 && \
                  if exist $@.manifest del $@.manifest
 
+# Set the install location of the compiler headers/libraries.
+# These are saved into $Config{incpath} and $Config{libpth}.
+CCINCDIR       = $(CCHOME)\include
+!IF "$(CCTYPE)" == "MSVC141"
+!  IF "$(WIN64)" == "define"
+CCLIBDIR       = $(CCHOME)\lib\x64
+!  ELSE
+CCLIBDIR       = $(CCHOME)\lib\x86
+!  ENDIF
+!ELSE
+CCLIBDIR       = $(CCHOME)\lib
+!ENDIF
+
 ARCHDIR                = ..\lib\$(ARCHNAME)
 COREDIR                = ..\lib\CORE
 AUTODIR                = ..\lib\auto
@@ -411,7 +459,6 @@ CPANDIR             = ..\cpan
 PODDIR         = ..\pod
 HTMLDIR                = .\html
 
-#
 INST_SCRIPT    = $(INST_TOP)$(INST_VER)\bin
 INST_BIN       = $(INST_SCRIPT)$(INST_ARCH)
 INST_LIB       = $(INST_TOP)$(INST_VER)\lib
@@ -443,7 +490,11 @@ DEFINES            = -DWIN32 -D_CONSOLE -DNO_STRICT
 LOCDEFS                = -DPERLDLL -DPERL_CORE
 CXX_FLAG       = -TP -EHsc
 
+!IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+LIBC           = ucrt.lib
+!ELSE
 LIBC           = msvcrt.lib
+!ENDIF
 
 !IF  "$(CFG)" == "Debug"
 OPTIMIZE       = -Od -MD -Zi -DDEBUGGING
@@ -454,7 +505,11 @@ OPTIMIZE   = -Od -MD -Zi
 LINK_DBG       = -debug
 !ELSE
 !IF  "$(CFG)" == "DebugFull"
+!IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+LIBC           = ucrtd.lib
+!ELSE
 LIBC           = msvcrtd.lib
+!ENDIF
 OPTIMIZE       = -Od -MDd -Zi -D_DEBUG -DDEBUGGING
 LINK_DBG       = -debug
 !ELSE
@@ -489,6 +544,11 @@ OPTIMIZE   = $(OPTIMIZE) -fp:precise
 DEFINES                = $(DEFINES) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
 !ENDIF
 
+# Likewise for deprecated Winsock APIs in VC++ 14.0 onwards for now.
+!IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+DEFINES                = $(DEFINES) -D_WINSOCK_DEPRECATED_NO_WARNINGS
+!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
@@ -509,6 +569,14 @@ LIBBASEFILES       = \
                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  "$(CFG)" == "DebugFull"
+LIBBASEFILES   = $(LIBBASEFILES) msvcrtd.lib vcruntimed.lib
+!  ELSE
+LIBBASEFILES   = $(LIBBASEFILES) msvcrt.lib vcruntime.lib
+!  ENDIF
+!ENDIF
+
 # Avoid __intel_new_proc_init link error for libircmt.
 # libmmd is /MD equivelent, other variants exist.
 # libmmd is Intel C's math addon funcs to MS CRT, contains long doubles, C99,
@@ -547,26 +615,26 @@ EXEOUT_FLAG       = -Fe
 CFLAGS_O       = $(CFLAGS) $(BUILDOPT)
 
 !IF "$(PREMSVC80)" == "undef"
-LINK_FLAGS     = $(LINK_FLAGS) "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"
+PRIV_LINK_FLAGS        = $(PRIV_LINK_FLAGS) "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"
 !ELSE
 RSC_FLAGS      = -DINCLUDE_MANIFEST
 !ENDIF
 
+# VS 2017 (VC++ 14.1) requires at minimum Windows 7 SP1 (with latest Windows Updates)
+
 # For XP support in >= VS 2013 (VC++ 12.0), subsystem is always in Config.pm
 # 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)" == "MSVC120FREE" \
-    || "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC140FREE"
+!IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140"
 !  IF "$(WIN64)" == "define"
 LINK_FLAGS     = $(LINK_FLAGS) -subsystem:console,"5.02"
 !  ELSE
 LINK_FLAGS     = $(LINK_FLAGS) -subsystem:console,"5.01"
 !  ENDIF
-PRIV_LINK_FLAGS        =
 
 !ELSE
-PRIV_LINK_FLAGS        = -subsystem:console
+PRIV_LINK_FLAGS        = $(PRIV_LINK_FLAGS) -subsystem:console
 !ENDIF
 
 BLINK_FLAGS    = $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
@@ -607,9 +675,9 @@ $(o).dll:
 
 # 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     = ..\perl523.lib
-PERLSTATICLIB  = ..\perl523s.lib
-PERLDLL                = ..\perl523.dll
+PERLIMPLIB     = ..\perl527.lib
+PERLSTATICLIB  = ..\perl527s.lib
+PERLDLL                = ..\perl527.dll
 
 MINIPERL       = ..\miniperl.exe
 MINIDIR                = .\mini
@@ -656,8 +724,6 @@ UTILS               =                       \
                ..\utils\splain         \
                ..\utils\perlbug        \
                ..\utils\pl2pm          \
-               ..\utils\c2ph           \
-               ..\utils\pstruct        \
                ..\utils\h2xs           \
                ..\utils\perldoc        \
                ..\utils\perlivp        \
@@ -859,6 +925,7 @@ CFG_VARS    =                                       \
                "uselongdouble=undef"                   \
                "uselargefiles=$(USE_LARGE_FILES)"      \
                "usesitecustomize=$(USE_SITECUST)"      \
+               "default_inc_excludes_dot=$(DEFAULT_INC_EXCLUDES_DOT)"  \
                "LINK_FLAGS=$(LINK_FLAGS:"=\")"         \
                "optimize=$(OPTIMIZE:"=\")"             \
                "WIN64=$(WIN64)"
@@ -892,9 +959,6 @@ $(GLOBEXE) : perlglob$(o)
 
 perlglob$(o)  : perlglob.c
 
-config.w32 : $(CFGSH_TMPL)
-       copy $(CFGSH_TMPL) config.w32
-
 #
 # Copy the template config.h and set configurables at the end of it
 # as per the options chosen and compiler used.
@@ -910,6 +974,17 @@ config.w32 : $(CFGSH_TMPL)
        @echo.>>$@
        @echo #ifndef _config_h_footer_>>$@
        @echo #define _config_h_footer_>>$@
+!IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141"
+       @echo #undef FILE_ptr>>$@
+       @echo #define FILE_ptr(fp) PERLIO_FILE_ptr(fp)>>$@
+       @echo #undef FILE_cnt>>$@
+       @echo #define FILE_cnt(fp) PERLIO_FILE_cnt(fp)>>$@
+       @echo #undef FILE_base>>$@
+       @echo #define FILE_base(fp) PERLIO_FILE_base(fp)>>$@
+       @echo #undef FILE_bufsiz>>$@
+       @echo #define FILE_bufsiz(fp) (PERLIO_FILE_cnt(fp) + PERLIO_FILE_ptr(fp) - PERLIO_FILE_base(fp))>>$@
+       @echo #define I_STDBOOL>>$@
+!ENDIF
        @echo #undef Off_t>>$@
        @echo #undef LSEEKSIZE>>$@
        @echo #undef Off_t_size>>$@
@@ -996,8 +1071,8 @@ config.w32 : $(CFGSH_TMPL)
 # make sure that we recompile perl.c if the git version changes
 ..\perl$(o) : ..\git_version.h
 
-..\config.sh : config.w32 $(MINIPERL) config_sh.PL FindExt.pm
-       $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh
+..\config.sh : $(CFGSH_TMPL) config_sh.PL FindExt.pm $(MINIPERL)
+       $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
 
 # This target is for when changes to the main config.sh happen.
 # Edit config.vc, then make perl in a minimal configuration (i.e. with MULTI,
@@ -1023,7 +1098,7 @@ $(MINIPERL) : ..\lib\buildcustomize.pl
 
 ..\lib\buildcustomize.pl : $(MINIDIR) $(MINI_OBJ) ..\write_buildcustomize.pl
        $(LINK32) -out:$(MINIPERL) @<<
-       $(BLINK_FLAGS) $(DELAYLOAD) $(LIBFILES) $(MINI_OBJ)
+       $(BLINK_FLAGS) $(DELAYLOAD) $(MINIDELAYLOAD) $(LIBFILES) $(MINI_OBJ)
 <<
        $(EMBED_EXE_MANI:..\lib\buildcustomize.pl=..\miniperl.exe)
        $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl ..
@@ -1195,7 +1270,7 @@ utils: $(PERLEXE) ..\utils\Makefile
        copy ..\README.tw       ..\pod\perltw.pod
        copy ..\README.vos      ..\pod\perlvos.pod
        copy ..\README.win32    ..\pod\perlwin32.pod
-       copy ..\pod\perldelta.pod ..\pod\perl5233delta.pod
+       copy ..\pod\perldelta.pod ..\pod\perl5277delta.pod
        cd ..\win32
        $(PERLEXE) $(PL2BAT) $(UTILS)
        $(MINIPERL) -I..\lib ..\autodoc.pl ..
@@ -1257,6 +1332,7 @@ distclean: realclean
        -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash
        -if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP
        -if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N
+       -if exist $(LIBDIR)\inc rmdir /s /q $(LIBDIR)\inc
        -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
        -if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC
        -if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON
@@ -1281,6 +1357,7 @@ distclean: realclean
        -if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP
        -if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term
        -if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
+       -if exist $(LIBDIR)\Test2 rmdir /s /q $(LIBDIR)\Test2
        -if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text
        -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
        -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
@@ -1292,7 +1369,7 @@ distclean: realclean
        -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 \
-           perl5233delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
+           perl5277delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
            perlapi.pod perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
            perldos.pod perlfreebsd.pod perlhaiku.pod perlhpux.pod \
            perlhurd.pod perlintern.pod perlirix.pod perljp.pod perlko.pod \
@@ -1302,7 +1379,7 @@ distclean: realclean
            perlsolaris.pod perlsymbian.pod perlsynology.pod perltoc.pod \
            perltru64.pod perltw.pod perluniprops.pod perlvos.pod \
            perlwin32.pod
-       -cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
+       -cd ..\utils && del /f h2ph splain perlbug pl2pm h2xs \
            perldoc perlivp libnetcfg enc2xs encguess piconv cpan *.bat \
            xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
        -del /f ..\config.sh perlmain.c dlutils.c config.h.new \
@@ -1400,7 +1477,6 @@ _clean :
        -@$(DEL) perlglob$(o)
        -@$(DEL) perlmain$(o)
        -@$(DEL) perlmainst$(o)
-       -@$(DEL) config.w32
        -@$(DEL) config.h
        -@$(DEL) ..\git_version.h
        -@$(DEL) $(GLOBEXE)