applied suggested fix for xhv_array sizing, with portability tweaks
[p5sagit/p5-mst-13.2.git] / win32 / Makefile
index 60eda26..8cc01bb 100644 (file)
@@ -1,17 +1,22 @@
-# Makefile to build perl on Windowns NT using Microsoft NMAKE.
-# Works with MS command line compilers from VC++ etc.
+#
+# Makefile to build perl on Windows NT using Microsoft NMAKE.
 #
 # This is set up to build a perl.exe that runs off a shared library
 # (perl.dll).  Also makes individual DLLs for the XS extensions.
-# NB: Miniperl has a different set of objects it depends on than
-# perl.exe
-# Also, Miniperl will not build with -DPERL_OBJECT defined
+#
+
+##
+## Build configuration.  Edit the values below to suit your needs.
+##
+
 #
 # Set these to wherever you want "nmake install" to put your
 # newly built perl.
+#
 INST_DRV       = c:
 INST_TOP       = $(INST_DRV)\perl
 
+#
 # Comment this out if you DON'T want your perl installation to be versioned.
 # This means that the new installation will overwrite any files from the
 # old installation at the same INST_TOP location.  Leaving it enabled is
@@ -19,43 +24,58 @@ INST_TOP    = $(INST_DRV)\perl
 # locations it installs files to.  If you disable it, an alternative
 # versioned installation can be obtained by setting INST_TOP above to a
 # path that includes an arbitrary version string.
-INST_VER       = \5.00467
+#
+INST_VER       = \5.00469
 
 #
 # uncomment to enable threads-capabilities
+#
 #USE_THREADS   = define
 
 #
 # uncomment next line if you are using Visual C++ 2.x
+#
 #CCTYPE                = MSVC20
 
 #
 # uncomment next line if you want to use the perl object
 # Currently, this cannot be enabled if you ask for threads above
+#
 #OBJECT                = -DPERL_OBJECT
 
 #
 # uncomment next line if you want debug version of perl (big,slow)
+#
 #CFG           = Debug
 
 #
+# uncomment to enable use of PerlCRT.DLL.  Highly recommended.  It has
+# patches that fix known bugs in MSCVRT.DLL.  You will need to download it
+# from: <TBD> and follow the directions in the package to install.
+#
+#USE_PERLCRT   = define
+
+#
 # if you have the source for des_fcrypt(), uncomment this and make sure the
 # file exists (see README.win32).  File should be located at the perl
 # top level directory.
+#
 #CRYPT_SRC     = des_fcrypt.c
 
 #
 # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a
 # library, uncomment this, and make sure the library exists (see README.win32)
 # Specify the full pathname of the library.
+#
 #CRYPT_LIB     = des_fcrypt.lib
 
 #
 # set this if you wish to use perl's malloc
 # WARNING: Turning this on/off WILL break binary compatibility with extensions
-# you may have compiled with/without it.  Be prepared to recompile all extensions
-# if you change the default.  Currently, this cannot be enabled if you ask for
-# PERL_OBJECT above.
+# you may have compiled with/without it.  Be prepared to recompile all
+# extensions if you change the default.  Currently, this cannot be enabled
+# if you ask for PERL_OBJECT above.
+#
 #PERL_MALLOC   = define
 
 #
@@ -74,8 +94,13 @@ EXTRALIBDIRS =
 #
 # set this to your email address (perl will guess a value from
 # from your loginname and your hostname, which may not be right)
+#
 #EMAIL         = 
 
+##
+## Build configuration ends.
+##
+
 ##################### CHANGE THESE ONLY IF YOU MUST #####################
 
 !IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
@@ -135,8 +160,22 @@ LOCDEFS            = -DPERLDLL -DPERL_CORE
 SUBSYS         = console
 CXX_FLAG       = -TP -GX
 
+!IF "$(USE_PERLCRT)" == ""
+!   IF  "$(CFG)" == "Debug"
+PERLCRTLIBC    = msvcrtd.lib
+!   ELSE
+PERLCRTLIBC    = msvcrt.lib
+!   ENDIF
+!ELSE
+!   IF  "$(CFG)" == "Debug"
+PERLCRTLIBC    = PerlCRTD.lib
+!   ELSE
+PERLCRTLIBC    = PerlCRT.lib
+!   ENDIF
+!ENDIF
+
 !IF "$(RUNTIME)" == "-MD"
-LIBC           = msvcrt.lib
+LIBC           = $(PERLCRTLIBC)
 !ELSE
 LIBC           = libcmt.lib
 !ENDIF
@@ -161,15 +200,17 @@ LINK_DBG  = -release
 OPTIMIZE       = $(OPTIMIZE) $(CXX_FLAG)
 !ENDIF
 
-# we don't add LIBC here, the compiler does it based on -MD/-MT
-LIBFILES       = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
+LIBBASEFILES   = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
                winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
                oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
                version.lib odbc32.lib odbccp32.lib
 
+# we add LIBC here, since we may be using PerlCRT.dll
+LIBFILES       = $(LIBBASEFILES) $(LIBC)
+
 CFLAGS         = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \
                $(PCHFLAGS) $(OPTIMIZE)
-LINK_FLAGS     = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
+LINK_FLAGS     = -nologo -nodefaultlib $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
 OBJOUT_FLAG    = -Fo
 EXEOUT_FLAG    = -Fe
 
@@ -257,7 +298,10 @@ MAKE               = nmake -nologo
 
 CFGSH_TMPL     = config.vc
 CFGH_TMPL      = config_H.vc
+
+!IF "$(USE_PERLCRT)" == ""
 PERL95EXE      = ..\perl95.exe
+!ENDIF
 
 XCOPY          = xcopy /f /r /i /d
 RCOPY          = xcopy /f /r /i /e /d
@@ -353,12 +397,12 @@ CORE_NOCFG_H      =               \
                ..\gv.h         \
                ..\handy.h      \
                ..\hv.h         \
+               ..\iperlsys.h   \
                ..\mg.h         \
                ..\nostdio.h    \
                ..\op.h         \
                ..\opcode.h     \
                ..\perl.h       \
-               ..\perlio.h     \
                ..\perlsdio.h   \
                ..\perlsfio.h   \
                ..\perly.h      \
@@ -406,6 +450,7 @@ PERL95_OBJ  = $(PERL95_OBJ) DynaLoadmt$(o)
 
 DYNAMIC_EXT    = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B
 STATIC_EXT     = DynaLoader
+NONXS_EXT      = Errno
 
 DYNALOADER     = $(EXTDIR)\DynaLoader\DynaLoader
 SOCKET         = $(EXTDIR)\Socket\Socket
@@ -417,6 +462,7 @@ POSIX               = $(EXTDIR)\POSIX\POSIX
 ATTRS          = $(EXTDIR)\attrs\attrs
 THREAD         = $(EXTDIR)\Thread\Thread
 B              = $(EXTDIR)\B\B
+ERRNO          = $(EXTDIR)\Errno\Errno
 
 SOCKET_DLL     = $(AUTODIR)\Socket\Socket.dll
 FCNTL_DLL      = $(AUTODIR)\Fcntl\Fcntl.dll
@@ -428,6 +474,8 @@ ATTRS_DLL   = $(AUTODIR)\attrs\attrs.dll
 THREAD_DLL     = $(AUTODIR)\Thread\Thread.dll
 B_DLL          = $(AUTODIR)\B\B.dll
 
+ERRNO_PM       = $(LIBDIR)\Errno.pm
+
 EXTENSION_C    =               \
                $(SOCKET).c     \
                $(FCNTL).c      \
@@ -449,6 +497,9 @@ EXTENSION_DLL       =               \
                $(ATTRS_DLL)    \
                $(B_DLL)
 
+EXTENSION_PM   =               \
+               $(ERRNO_PM)
+
 !IF "$(OBJECT)" == ""
 EXTENSION_DLL  =               \
                $(EXTENSION_DLL)\
@@ -472,12 +523,13 @@ CFG_VARS  =                                       \
                "d_mymalloc=$(PERL_MALLOC)"             \
                "libs=$(LIBFILES)"                      \
                "incpath=$(CCINCDIR)"                   \
-               "libperl=$(PERLIMPLIB)"                 \
+               "libperl=$(PERLIMPLIB:..\=)"                    \
                "libpth=$(CCLIBDIR) $(EXTRALIBDIRS)"    \
                "libc=$(LIBC)"                          \
                "make=nmake"                            \
                "static_ext=$(STATIC_EXT)"              \
                "dynamic_ext=$(DYNAMIC_EXT)"            \
+               "nonxs_ext=$(NONXS_EXT)"                \
                "usethreads=$(USE_THREADS)"             \
                "LINK_FLAGS=$(LINK_FLAGS)"              \
                "optimize=$(OPTIMIZE)"
@@ -487,7 +539,7 @@ CFG_VARS    =                                       \
 #
 
 all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \
-       $(CAPILIB) $(X2P) $(EXTENSION_DLL)
+       $(CAPILIB) $(X2P) $(EXTENSION_DLL) $(EXTENSION_PM)
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
@@ -606,6 +658,8 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
        copy splittree.pl .. 
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
 
+!IF "$(USE_PERLCRT)" == ""
+
 perl95.c : runperl.c 
        copy runperl.c perl95.c
 
@@ -626,7 +680,9 @@ DynaLoadmt$(o) : $(DYNALOADER).c
 
 $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
        $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \
-           $(LIBFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
+           $(LIBBASEFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
+
+!ENDIF
 
 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
        if not exist $(AUTODIR) mkdir $(AUTODIR)
@@ -707,6 +763,12 @@ $(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs
        $(MAKE)
        cd ..\..\win32
 
+$(ERRNO_PM): $(PERLEXE) $(ERRNO)_pm.PL
+       cd $(EXTDIR)\$(*B)
+       ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+       $(MAKE)
+       cd ..\..\win32
+
 doc: $(PERLEXE)
        copy ..\README.win32 ..\pod\perlwin32.pod
        $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=./html \
@@ -725,8 +787,8 @@ distclean: clean
        -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
                $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
        -del /f *.def *.map
-       -del /f $(EXTENSION_DLL)
-       -del /f $(EXTENSION_C) $(DYNALOADER).c
+       -del /f $(EXTENSION_DLL) $(EXTENSION_PM)
+       -del /f $(EXTENSION_C) $(DYNALOADER).c $(ERRNO).pm
        -del /f $(EXTDIR)\DynaLoader\dl_win32.xs
        -del /f $(LIBDIR)\.exists $(LIBDIR)\attrs.pm $(LIBDIR)\DynaLoader.pm
        -del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
@@ -760,7 +822,9 @@ install : all installbare installhtml
 
 installbare : utils
        $(PERLEXE) ..\installperl
+!IF "$(USE_PERLCRT)" == ""
        $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
+!ENDIF
        $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
        $(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
        $(XCOPY) bin\network.pl $(INST_LIB)\*.*