This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #123659] [Win32] Add "-ld" to archname for dmake "long double" builds of perl
[perl5.git] / win32 / makefile.mk
index 5a69973..5ca5caa 100644 (file)
@@ -32,6 +32,7 @@ INST_TOP      *= $(INST_DRV)\perl
 #
 # Uncomment if you want to build a 32-bit Perl using a 32-bit compiler
 # on a 64-bit version of Windows.
+#
 #WIN64         *= undef
 
 #
@@ -43,7 +44,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.21.6
+#INST_VER      *= \5.21.9
 
 #
 # Comment this out if you DON'T want your perl installation to have
@@ -86,17 +87,10 @@ USE_ITHREADS        *= define
 USE_IMP_SYS    *= define
 
 #
-# Comment out next assign to disable perl's I/O subsystem and use compiler's 
-# stdio for IO - depending on your compiler vendor and run time library you may 
-# then get a number of fails from make test i.e. bugs - complain to them not us ;-). 
-# You will also be unable to take full advantage of perl5.8's support for multiple 
-# encodings and may see lower IO performance. You have been warned.
-USE_PERLIO     *= define
-
-#
 # Comment this out if you don't want to enable large file support for
 # some reason.  Should normally only be changed to maintain compatibility
 # with an older release of perl.
+#
 USE_LARGE_FILES        *= define
 
 #
@@ -104,9 +98,16 @@ USE_LARGE_FILES     *= define
 # (If you're building a 64-bit perl then you will have 64-bit integers whether
 # or not this is uncommented.)
 # Note: This option is not supported in 32-bit MSVC60 builds.
+#
 #USE_64_BIT_INT        *= define
 
 #
+# Uncomment this if you want to support the use of long doubles in GCC builds.
+# This option is not supported for MSVC builds.
+#
+#USE_LONG_DOUBLE *=define
+
+#
 # uncomment exactly one of the following
 #
 # Visual C++ 6.x (aka Visual C++ 98)
@@ -289,9 +290,9 @@ USE_SITECUST        *= undef
 USE_MULTI      *= undef
 USE_ITHREADS   *= undef
 USE_IMP_SYS    *= undef
-USE_PERLIO     *= undef
 USE_LARGE_FILES        *= undef
 USE_64_BIT_INT *= undef
+USE_LONG_DOUBLE        *= undef
 
 .IF "$(USE_IMP_SYS)" == "define"
 PERL_MALLOC    = undef
@@ -358,6 +359,12 @@ CCTYPE             = SDK2003SP1
 USE_64_BIT_INT != undef
 .ENDIF
 
+# Disable the long double option for MSVC builds since that compiler
+# does not support it.
+.IF "$(CCTYPE)" != "GCC"
+USE_LONG_DOUBLE        != undef
+.ENDIF
+
 ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
 .IF "$(ARCHITECTURE)" == "AMD64"
 ARCHITECTURE   = x64
@@ -369,15 +376,7 @@ ARCHITECTURE       = ia64
 .IF "$(USE_MULTI)" == "define"
 ARCHNAME       = MSWin32-$(ARCHITECTURE)-multi
 .ELSE
-.IF "$(USE_PERLIO)" == "define"
 ARCHNAME       = MSWin32-$(ARCHITECTURE)-perlio
-.ELSE
-ARCHNAME       = MSWin32-$(ARCHITECTURE)
-.ENDIF
-.ENDIF
-
-.IF "$(USE_PERLIO)" == "define"
-BUILDOPT       += -DUSE_PERLIO
 .ENDIF
 
 .IF "$(USE_ITHREADS)" == "define"
@@ -390,6 +389,10 @@ ARCHNAME   !:= $(ARCHNAME)-64int
 .ENDIF
 .ENDIF
 
+.IF "$(USE_LONG_DOUBLE)" == "define"
+ARCHNAME       !:= $(ARCHNAME)-ld
+.ENDIF
+
 ARCHDIR                = ..\lib\$(ARCHNAME)
 COREDIR                = ..\lib\CORE
 AUTODIR                = ..\lib\auto
@@ -428,6 +431,11 @@ LIB32              = $(ARCHPREFIX)ar rc
 IMPLIB         = $(ARCHPREFIX)dlltool
 RSC            = $(ARCHPREFIX)windres
 
+.IF "$(USE_LONG_DOUBLE)" == "define"
+BUILDOPT        += -D__USE_MINGW_ANSI_STDIO
+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))
 
 .IF "$(GCCWRAPV)" == "define"
@@ -603,6 +611,9 @@ LIBBASEFILES    += bufferoverflowU.lib
 LIBFILES       = $(LIBBASEFILES) $(LIBC)
 
 EXTRACFLAGS    = -nologo -GF -W3
+.IF "$(__ICC)" == "define"
+EXTRACFLAGS    = $(EXTRACFLAGS) -Qstd=c99
+.ENDIF
 CFLAGS         = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \
                $(PCHFLAGS) $(OPTIMIZE)
 LINK_FLAGS     = -nologo -nodefaultlib $(LINK_DBG) \
@@ -829,16 +840,11 @@ EXTRACORE_SRC     += ..\perlio.c
 
 WIN32_SRC      =               \
                .\win32.c       \
+               .\win32io.c     \
                .\win32sck.c    \
                .\win32thread.c \
                .\fcrypt.c
 
-# We need this for miniperl build unless we override canned 
-# config.h #define building mini\*
-#.IF "$(USE_PERLIO)" == "define"
-WIN32_SRC      += .\win32io.c
-#.ENDIF
-
 CORE_NOCFG_H   =               \
                ..\av.h         \
                ..\cop.h        \
@@ -947,8 +953,8 @@ CFG_VARS    =                                       \
                usethreads=$(USE_ITHREADS)      ~       \
                useithreads=$(USE_ITHREADS)     ~       \
                usemultiplicity=$(USE_MULTI)    ~       \
-               useperlio=$(USE_PERLIO)         ~       \
                use64bitint=$(USE_64_BIT_INT)   ~       \
+               uselongdouble=$(USE_LONG_DOUBLE)        ~       \
                uselargefiles=$(USE_LARGE_FILES)        ~       \
                usesitecustomize=$(USE_SITECUST)        ~       \
                LINK_FLAGS=$(LINK_FLAGS)        ~       \
@@ -1024,6 +1030,7 @@ config.w32 : $(CFGSH_TMPL)
        @echo #undef HAS_ATOLL>>$@
        @echo #undef HAS_STRTOLL>>$@
        @echo #undef HAS_STRTOULL>>$@
+       @echo #undef Size_t_size>>$@
        @echo #undef IVTYPE>>$@
        @echo #undef UVTYPE>>$@
        @echo #undef IVSIZE>>$@
@@ -1036,7 +1043,25 @@ config.w32 : $(CFGSH_TMPL)
        @echo #undef UVxf>>$@
        @echo #undef UVXf>>$@
        @echo #undef USE_64_BIT_INT>>$@
-       @echo #undef Size_t_size>>$@
+       @echo #undef Gconvert>>$@
+       @echo #undef HAS_FREXPL>>$@
+       @echo #undef HAS_ISNANL>>$@
+       @echo #undef HAS_MODFL>>$@
+       @echo #undef HAS_MODFL_PROTO>>$@
+       @echo #undef HAS_SQRTL>>$@
+       @echo #undef HAS_STRTOLD>>$@
+       @echo #undef PERL_PRIfldbl>>$@
+       @echo #undef PERL_PRIgldbl>>$@
+       @echo #undef PERL_PRIeldbl>>$@
+       @echo #undef PERL_SCNfldbl>>$@
+       @echo #undef NVTYPE>>$@
+       @echo #undef NVSIZE>>$@
+       @echo #undef LONG_DOUBLESIZE>>$@
+       @echo #undef NV_OVERFLOWS_INTEGERS_AT>>$@
+       @echo #undef NVef>>$@
+       @echo #undef NVff>>$@
+       @echo #undef NVgf>>$@
+       @echo #undef USE_LONG_DOUBLE>>$@
 .IF "$(USE_LARGE_FILES)"=="define"
        @echo #define Off_t $(INT64)>>$@
        @echo #define LSEEKSIZE ^8>>$@
@@ -1066,8 +1091,13 @@ config.w32 : $(CFGSH_TMPL)
        @echo #define UVTYPE unsigned $(INT64)>>$@
        @echo #define IVSIZE ^8>>$@
        @echo #define UVSIZE ^8>>$@
+.IF "$(USE_LONG_DOUBLE)"=="define"
+       @echo #define NV_PRESERVES_UV>>$@
+       @echo #define NV_PRESERVES_UV_BITS 64>>$@
+.ELSE
        @echo #undef NV_PRESERVES_UV>>$@
        @echo #define NV_PRESERVES_UV_BITS 53>>$@
+.ENDIF
        @echo #define IVdf "I64d">>$@
        @echo #define UVuf "I64u">>$@
        @echo #define UVof "I64o">>$@
@@ -1088,6 +1118,52 @@ config.w32 : $(CFGSH_TMPL)
        @echo #define UVXf "lX">>$@
        @echo #undef USE_64_BIT_INT>>$@
 .ENDIF
+.IF "$(USE_LONG_DOUBLE)"=="define"
+       @echo #define Gconvert(x,n,t,b) sprintf((b),"%.*""Lg",(n),(x))>>$@
+       @echo #define HAS_FREXPL>>$@
+       @echo #define HAS_ISNANL>>$@
+       @echo #define HAS_MODFL>>$@
+       @echo #define HAS_MODFL_PROTO>>$@
+       @echo #define HAS_SQRTL>>$@
+       @echo #define HAS_STRTOLD>>$@
+       @echo #define PERL_PRIfldbl "Lf">>$@
+       @echo #define PERL_PRIgldbl "Lg">>$@
+       @echo #define PERL_PRIeldbl "Le">>$@
+       @echo #define PERL_SCNfldbl "Lf">>$@
+       @echo #define NVTYPE long double>>$@
+.IF "$(WIN64)"=="define"
+       @echo #define NVSIZE ^16>>$@
+       @echo #define LONG_DOUBLESIZE ^16>>$@
+.ELSE
+       @echo #define NVSIZE ^12>>$@
+       @echo #define LONG_DOUBLESIZE ^12>>$@
+.ENDIF
+       @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>>$@
+       @echo #define NVef "Le">>$@
+       @echo #define NVff "Lf">>$@
+       @echo #define NVgf "Lg">>$@
+       @echo #define USE_LONG_DOUBLE>>$@
+.ELSE
+       @echo #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))>>$@
+       @echo #undef HAS_FREXPL>>$@
+       @echo #undef HAS_ISNANL>>$@
+       @echo #undef HAS_MODFL>>$@
+       @echo #undef HAS_MODFL_PROTO>>$@
+       @echo #undef HAS_SQRTL>>$@
+       @echo #undef HAS_STRTOLD>>$@
+       @echo #undef PERL_PRIfldbl>>$@
+       @echo #undef PERL_PRIgldbl>>$@
+       @echo #undef PERL_PRIeldbl>>$@
+       @echo #undef PERL_SCNfldbl>>$@
+       @echo #define NVTYPE double>>$@
+       @echo #define NVSIZE ^8>>$@
+       @echo #define LONG_DOUBLESIZE ^8>>$@
+       @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>>$@
+       @echo #define NVef "e">>$@
+       @echo #define NVff "f">>$@
+       @echo #define NVgf "g">>$@
+       @echo #undef USE_LONG_DOUBLE>>$@
+.ENDIF
        @echo #endif>>$@
 
 ..\git_version.h : $(MINIPERL) ..\make_patchnum.pl
@@ -1102,7 +1178,7 @@ config.w32 : $(CFGSH_TMPL)
 
 # This target is for when changes to the main config.sh happen.
 # Edit config.gc, then make perl using GCC in a minimal configuration (i.e.
-# with MULTI, ITHREADS, IMP_SYS, LARGE_FILES and PERLIO off), then make
+# with MULTI, ITHREADS, IMP_SYS and LARGE_FILES off), then make
 # this target to regenerate config_H.gc.
 regen_config_h:
        $(MINIPERL) -I..\lib config_sh.PL --cfgsh-option-file $(mktmp $(CFG_VARS)) \
@@ -1303,7 +1379,7 @@ Extensions_realclean :
 
 
 doc: $(PERLEXE) ..\pod\perltoc.pod
-       $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
+       $(PERLEXE) ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
            --podpath=pod:lib:utils --htmlroot="file://$(INST_HTML:s,:,|,)"\
            --recurse
 
@@ -1347,7 +1423,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\perl5216delta.pod
+       copy ..\pod\perldelta.pod ..\pod\perl5219delta.pod
        $(PERLEXE) $(PL2BAT) $(UTILS)
        $(MINIPERL) -I..\lib ..\autodoc.pl ..
        $(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
@@ -1442,7 +1518,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 \
-           perl5216delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
+           perl5219delta.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 \
@@ -1493,26 +1569,27 @@ $(UNIDATAFILES) ..\pod\perluniprops.pod .UPDATEALL : $(MINIPERL) $(CONFIGPM) ..\
        cd ..\lib\unicore && \
        ..\$(MINIPERL) -I.. -I..\..\dist\Cwd\lib -I..\..\dist\Cwd mktables -P ..\..\pod -maketest -makelist -p
 
-minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
+minitest : .\config.h $(MINIPERL) ..\git_version.h $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) test-prep-gcc
        $(XCOPY) $(MINIPERL) ..\t\$(NULL)
        if exist ..\t\perl.exe del /f ..\t\perl.exe
        rename ..\t\miniperl.exe perl.exe
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
-       attrib -r ..\t\*.*
-       cd ..\t && \
-       $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
+# Note this perl.exe is miniperl
+       cd ..\t && perl.exe TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t pragma/*.t
 
-test-prep : all utils ..\pod\perltoc.pod
+test-prep : all utils ..\pod\perltoc.pod test-prep-gcc
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
-.IF "$(CCTYPE)" == "GCC"
+
 # If building with gcc versions 4.x.x or greater, then
 # the GCC helper DLL will also need copied to the test directory.
 # The name of the dll can change, depending upon which vendor has supplied
 # your compiler, and upon the values of "x".
 # libstdc++-6.dll is copied if it exists as it, too, may then be needed.
 # Without this copying, the op/taint.t test script will fail.
+test-prep-gcc :
+.IF "$(CCTYPE)" == "GCC"
        if exist $(CCDLLDIR)\libgcc_s_seh-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_seh-1.dll ..\t\$(NULL)
        if exist $(CCDLLDIR)\libgcc_s_sjlj-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_sjlj-1.dll ..\t\$(NULL)
        if exist $(CCDLLDIR)\libgcc_s_dw2-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_dw2-1.dll ..\t\$(NULL)
@@ -1522,34 +1599,32 @@ test-prep : all utils ..\pod\perltoc.pod
 
 test : test-prep
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
-           cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
 
 test_porting : test-prep
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
-           cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
 
 test-reonly : reonly utils
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
-       cd ..\t && \
-       $(PERLEXE) -I..\lib harness $(OPT) -re \bpat\\/ $(EXTRA) && \
-       cd ..\win32
+       cd ..\t && perl.exe harness $(OPT) -re \bpat\\/ $(EXTRA)
 
 regen :
-       cd .. && regen.pl && cd win32
+       cd .. && regen.pl
 
 test-notty : test-prep
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
            set PERL_SKIP_TTY_TEST=1 && \
-           cd ..\t && $(PERLEXE) -I.\lib harness $(TEST_SWITCHES) $(TEST_FILES)
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
 
 _test :
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
        set PERL_STATIC_EXT=$(STATIC_EXT) && \
-           cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
+           cd ..\t && perl.exe harness $(TEST_SWITCHES) $(TEST_FILES)
 
 _clean :
        -@erase miniperlmain$(o)
@@ -1591,13 +1666,13 @@ realclean : Extensions_realclean _clean
 # Please *don't* use this unless all tests pass.
 # If you want to report test failures, use "dmake nok" instead.
 ok: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)"
+       $(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)"
 
 okfile: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
+       $(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
 
 nok: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)"
+       $(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)"
 
 nokfile: utils
-       $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok
+       $(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok