IO::Socket now sets $!, avoids eval/die (patch from Graham Barr
[p5sagit/p5-mst-13.2.git] / win32 / makefile.mk
index 01034bb..6357300 100644 (file)
@@ -33,7 +33,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.5.640
+INST_VER       *= \5.5.660
 
 #
 # Comment this out if you DON'T want your perl installation to have
@@ -47,43 +47,47 @@ INST_VER    *= \5.5.640
 INST_ARCH      *= \$(ARCHNAME)
 
 #
-# XXX WARNING! This option currently undergoing changes.  May be broken.
+# uncomment to enable multiple interpreters.  This is need for fork()
+# emulation.
 #
-# uncomment to enable threads-capabilities
-#
-#USE_5005THREADS       *= define
+#USE_MULTI     *= define
 
 #
-# XXX WARNING! This option currently undergoing changes.  May be broken.
+# XXX WARNING! This option is still very experimental.  May be broken.
 #
-# uncomment to enable multiple interpreters
+# Beginnings of interpreter cloning/threads; still very incomplete.
+# This should be enabled to get the fork() emulation.  This needs
+# USE_MULTI as well.
 #
-#USE_MULTI     *= define
+#USE_ITHREADS  *= define
 
 #
-# XXX WARNING! This option currently undergoing changes.  May be broken.
-#
-# uncomment next line if you want to use the perl object
-# Currently, this cannot be enabled if you ask for threads above, or
-# if you are using GCC or EGCS.
+# uncomment to enable the implicit "host" layer for all system calls
+# made by perl.  This needs USE_MULTI above.  This is also needed to
+# get fork().
 #
-#USE_OBJECT    *= define
+#USE_IMP_SYS   *= define
 
 #
-# XXX WARNING! This option currently undergoing changes.  May be broken.
+# WARNING! This option is deprecated and will eventually go away (enable
+# USE_ITHREADS instead).
 #
-# Beginnings of interpreter cloning/threads: still rather rough, fails
-# tests.  This should be enabled to get the fork() emulation.  Do not
-# enable unless you know what you're doing!
+# uncomment to enable threads-capabilities.  This is incompatible with
+# USE_ITHREADS, and is only here for people who may have come to rely
+# on the experimental Thread support that was in 5.005.
 #
-#USE_ITHREADS  *= define
+#USE_5005THREADS       *= define
 
 #
-# uncomment to enable the implicit "host" layer for all system calls
-# made by perl.  This is needed and auto-enabled by USE_OBJECT above.
-# This is also needed to get fork().
+# WARNING! This option is deprecated and will eventually go away (enable
+# USE_MULTI instead).
 #
-#USE_IMP_SYS   *= define
+# uncomment next line if you want to use the PERL_OBJECT build option.
+# DO NOT ENABLE unless you have legacy code that relies on the C++
+# CPerlObj class that was available in 5.005.  This cannot be enabled
+# if you ask for USE_5005THREADS above.
+#
+#USE_OBJECT    *= define
 
 #
 # uncomment exactly one of the following
@@ -95,9 +99,9 @@ INST_ARCH     *= \$(ARCHNAME)
 # Visual C++ >= 6.x
 #CCTYPE                *= MSVC60
 # Borland 5.02 or later
-CCTYPE         *= BORLAND
-# mingw32/gcc-2.95.2 or better
-#CCTYPE                *= GCC
+#CCTYPE                *= BORLAND
+# mingw32+gcc-2.95.2 or better
+CCTYPE         *= GCC
 
 #
 # uncomment this if you are compiling under Windows 95/98 and command.com
@@ -118,6 +122,8 @@ CCTYPE              *= BORLAND
 # Get it from CPAN at http://www.perl.com/CPAN/authors/id/D/DO/DOUGL/
 # and follow the directions in the package to install.
 #
+# Not recommended if you have VC 6.x and you're not running Windows 9x.
+#
 #USE_PERLCRT   *= define
 
 #
@@ -148,7 +154,7 @@ CCTYPE              *= BORLAND
 # 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 USE_OBJECT above.
+# if you ask for USE_IMP_SYS above.
 #
 #PERL_MALLOC   *= define
 
@@ -159,9 +165,9 @@ CCTYPE              *= BORLAND
 # so you may have to set CCHOME explicitly (spaces in the path name should
 # not be quoted)
 #
-CCHOME         *= c:\bc5
+#CCHOME                *= c:\bc5
 #CCHOME                *= $(MSVCDIR)
-#CCHOME                *= D:\packages\mingw32
+CCHOME         *= c:\gcc-2.95.2-msvcrt
 CCINCDIR       *= $(CCHOME)\include
 CCLIBDIR       *= $(CCHOME)\lib
 
@@ -241,17 +247,27 @@ USE_5005THREADS   *= undef
 USE_ITHREADS   != undef
 .ENDIF
 
+.IF "$(USE_IMP_SYS)" == "define"
+PERL_MALLOC    != undef
+.ENDIF
+
 USE_MULTI      *= undef
 USE_OBJECT     *= undef
 USE_ITHREADS   *= undef
 USE_IMP_SYS    *= undef
+USE_PERLCRT    *= undef
 
-.IF "$(USE_MULTI)$(USE_5005THREADS)$(USE_OBJECT)" != "undefundefundef"
-BUILDOPT       += -DPERL_IMPLICIT_CONTEXT
+.IF "$(USE_IMP_SYS)$(USE_MULTI)$(USE_5005THREADS)$(USE_OBJECT)" == "defineundefundefundef"
+USE_MULTI      != define
+.ENDIF
+
+.IF "$(USE_ITHREADS)$(USE_MULTI)$(USE_OBJECT)" == "defineundefundef"
+USE_MULTI      != define
+USE_5005THREADS        != undef
 .ENDIF
 
-.IF "$(USE_ITHREADS)" != "undef"
-BUILDOPT       += -DUSE_ITHREADS
+.IF "$(USE_MULTI)$(USE_5005THREADS)$(USE_OBJECT)" != "undefundefundef"
+BUILDOPT       += -DPERL_IMPLICIT_CONTEXT
 .ENDIF
 
 .IF "$(USE_IMP_SYS)" != "undef"
@@ -272,8 +288,8 @@ ARCHNAME    = MSWin32-$(PROCESSOR_ARCHITECTURE)-multi
 ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)
 .ENDIF
 
-.IF "$(USE_OBJECT)" == "define"
-ARCHNAME       = $(ARCHNAME)-thread
+.IF "$(USE_ITHREADS)" == "define"
+ARCHNAME       !:= $(ARCHNAME)-thread
 .ENDIF
 
 # Visual Studio 98 specific
@@ -393,6 +409,9 @@ OBJOUT_FLAG = -o
 EXEOUT_FLAG    = -o
 LIBOUT_FLAG    = 
 
+# NOTE: we assume that GCC uses MSVCRT.DLL
+BUILDOPT       += -fno-strict-aliasing -DPERL_MSVCRT_READFIX
+
 .ELSE
 
 CC             = cl
@@ -412,7 +431,7 @@ LOCDEFS             = -DPERLDLL -DPERL_CORE
 SUBSYS         = console
 CXX_FLAG       = -TP -GX
 
-.IF "$(USE_PERLCRT)" == ""
+.IF "$(USE_PERLCRT)" != "define"
 .IF  "$(CFG)" == "Debug"
 PERLCRTLIBC    = msvcrtd.lib
 .ELSE
@@ -454,10 +473,10 @@ LINK_DBG  = -release
 .ENDIF
 
 LIBBASEFILES   = $(DELAYLOAD) $(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
+               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)
@@ -471,6 +490,10 @@ OBJOUT_FLAG        = -Fo
 EXEOUT_FLAG    = -Fe
 LIBOUT_FLAG    = /out:
 
+.IF "$(USE_PERLCRT)" != "define"
+BUILDOPT       += -DPERL_MSVCRT_READFIX
+.ENDIF
+
 .ENDIF
 
 .IF "$(USE_OBJECT)" == "define"
@@ -520,7 +543,7 @@ $(o).dll:
 .ENDIF
 
 .rc.res:
-       $(RSC) $<
+       $(RSC) -i.. $<
 
 #
 # various targets
@@ -556,6 +579,7 @@ UTILS               =                       \
                ..\pod\podselect        \
                ..\x2p\find2perl        \
                ..\x2p\s2p              \
+               bin\exetype.pl          \
                bin\runperl.pl          \
                bin\pl2bat.pl           \
                bin\perlglob.pl         \
@@ -570,29 +594,17 @@ CFGH_TMPL = config_H.bc
 
 CFGSH_TMPL     = config.gc
 CFGH_TMPL      = config_H.gc
-.IF "$(USE_OBJECT)" == "define"
-PERLIMPLIB     = ..\libperlcore$(a)
-.ELSE
-PERLIMPLIB     = ..\libperl$(a)
-.ENDIF
+PERLIMPLIB     = ..\libperl56$(a)
 
 .ELSE
 
 CFGSH_TMPL     = config.vc
 CFGH_TMPL      = config_H.vc
-.IF "$(USE_PERLCRT)" == ""
-PERL95EXE      = ..\perl95.exe
-.ENDIF
 
 .ENDIF
 
-.IF "$(USE_OBJECT)" == "define"
 PERLIMPLIB     *= ..\perl56$(a)
 PERLDLL                = ..\perl56.dll
-.ELSE
-PERLIMPLIB     *= ..\perl$(a)
-PERLDLL                = ..\perl.dll
-.ENDIF
 
 XCOPY          = xcopy /f /r /i /d
 RCOPY          = xcopy /f /r /i /e /d
@@ -656,15 +668,6 @@ WIN32_SRC  += .\win32thread.c
 WIN32_SRC      += .\$(CRYPT_SRC)
 .ENDIF
 
-PERL95_SRC     =               \
-               perl95.c        \
-               win32mt.c       \
-               win32sckmt.c
-
-.IF "$(CRYPT_SRC)" != ""
-PERL95_SRC     += .\$(CRYPT_SRC)
-.ENDIF
-
 DLL_SRC                = $(DYNALOADER).c
 
 X2P_SRC                =               \
@@ -725,7 +728,6 @@ WIN32_OBJ   = $(WIN32_SRC:db:+$(o))
 MINICORE_OBJ   = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)}
 MINIWIN32_OBJ  = $(MINIDIR)\{$(WIN32_OBJ:f)}
 MINI_OBJ       = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
-PERL95_OBJ     = $(PERL95_SRC:db:+$(o))
 DLL_OBJ                = $(DLL_SRC:db:+$(o))
 X2P_OBJ                = $(X2P_SRC:db:+$(o))
 
@@ -739,7 +741,8 @@ SETARGV_OBJ = setargv$(o)
 .ENDIF
 
 DYNAMIC_EXT    = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B re \
-               Data/Dumper Devel/Peek ByteLoader Devel/DProf File/Glob
+               Data/Dumper Devel/Peek ByteLoader Devel/DProf File/Glob \
+               Sys/Hostname
 STATIC_EXT     = DynaLoader
 NONXS_EXT      = Errno
 
@@ -760,6 +763,7 @@ PEEK                = $(EXTDIR)\Devel\Peek\Peek
 BYTELOADER     = $(EXTDIR)\ByteLoader\ByteLoader
 DPROF          = $(EXTDIR)\Devel\DProf\DProf
 GLOB           = $(EXTDIR)\File\Glob\Glob
+HOSTNAME       = $(EXTDIR)\Sys\Hostname\Hostname
 
 SOCKET_DLL     = $(AUTODIR)\Socket\Socket.dll
 FCNTL_DLL      = $(AUTODIR)\Fcntl\Fcntl.dll
@@ -776,6 +780,7 @@ RE_DLL              = $(AUTODIR)\re\re.dll
 BYTELOADER_DLL = $(AUTODIR)\ByteLoader\ByteLoader.dll
 DPROF_DLL      = $(AUTODIR)\Devel\DProf\DProf.dll
 GLOB_DLL       = $(AUTODIR)\File\Glob\Glob.dll
+HOSTNAME_DLL   = $(AUTODIR)\Sys\Hostname\Hostname.dll
 
 ERRNO_PM       = $(LIBDIR)\Errno.pm
 
@@ -794,7 +799,8 @@ EXTENSION_C =               \
                $(B).c          \
                $(BYTELOADER).c \
                $(DPROF).c      \
-               $(GLOB).c
+               $(GLOB).c       \
+               $(HOSTNAME).c
 
 EXTENSION_DLL  =               \
                $(SOCKET_DLL)   \
@@ -811,7 +817,8 @@ EXTENSION_DLL       =               \
                $(THREAD_DLL)   \
                $(BYTELOADER_DLL)       \
                $(DPROF_DLL)    \
-               $(GLOB_DLL)
+               $(GLOB_DLL)     \
+               $(HOSTNAME_DLL)
 
 EXTENSION_PM   =               \
                $(ERRNO_PM)
@@ -872,7 +879,7 @@ RIGHTMAKE   = __not_needed
 #
 
 all : .\config.h $(GLOBEXE) $(MINIPERL) $(MK2)         \
-       $(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE)     \
+       $(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(PERLEXE)  \
        $(X2P) $(EXTENSION_DLL) $(EXTENSION_PM)
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
@@ -954,7 +961,8 @@ config.w32 : $(CFGSH_TMPL)
 # edit config.{b,v,g}c and make this target once for each supported
 # compiler (e.g. `dmake CCTYPE=BORLAND regen_config_h`)
 regen_config_h:
-       perl config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
+       perl config_sh.PL --cfgsh-option-file $(mktmp $(CFG_VARS)) \
+           $(CFGSH_TMPL) > ..\config.sh
        -cd .. && del /f perl.exe
        cd .. && perl configpm
        -del /f $(CFGH_TMPL)
@@ -1010,7 +1018,6 @@ $(MINI_OBJ)       : $(CORE_NOCFG_H)
 $(WIN32_OBJ)   : $(CORE_H)
 $(CORE_OBJ)    : $(CORE_H)
 $(DLL_OBJ)     : $(CORE_H)
-$(PERL95_OBJ)  : $(CORE_H)
 $(X2P_OBJ)     : $(CORE_H)
 
 perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl
@@ -1092,43 +1099,12 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
 .ELSE
        $(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) $(LIBFILES) \
            $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES)
-       copy $(PERLEXE) $(WPERLEXE)
-       editbin /subsystem:windows $(WPERLEXE)
 .ENDIF
+       copy $(PERLEXE) $(WPERLEXE)
+       $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS
        copy splittree.pl .. 
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
 
-.IF "$(CCTYPE)" != "BORLAND"
-.IF "$(CCTYPE)" != "GCC"
-.IF "$(USE_PERLCRT)" == ""
-
-perl95.c : runperl.c 
-       copy runperl.c perl95.c
-
-perl95$(o) : perl95.c
-       $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c perl95.c
-
-win32sckmt$(o) : win32sck.c
-       $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \
-           $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c
-
-win32mt$(o) : win32.c
-       $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \
-           $(OBJOUT_FLAG)win32mt$(o) win32.c
-
-DynaLoadmt$(o) : $(DYNALOADER).c
-       $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \
-           $(OBJOUT_FLAG)DynaLoadmt$(o) $(DYNALOADER).c
-
-$(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
-       $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(BLINK_FLAGS) \
-           $(LIBBASEFILES) $(PERL95_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) \
-           libcmt.lib
-
-.ENDIF
-.ENDIF
-.ENDIF
-
 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
        if not exist $(AUTODIR) mkdir $(AUTODIR)
        cd $(EXTDIR)\$(*B) && ..\$(MINIPERL) -I..\..\lib $(*B)_pm.PL
@@ -1211,6 +1187,11 @@ $(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs
        ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
        cd $(EXTDIR)\$(*B) && $(MAKE)
 
+$(HOSTNAME_DLL): $(PERLEXE) $(HOSTNAME).xs
+       cd $(EXTDIR)\Sys\$(*B) && \
+       ..\..\..\miniperl -I..\..\..\lib Makefile.PL INSTALLDIRS=perl
+       cd $(EXTDIR)\Sys\$(*B) && $(MAKE)
+
 $(BYTELOADER_DLL): $(PERLEXE) $(BYTELOADER).xs
        cd $(EXTDIR)\$(*B) && \
        ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
@@ -1233,7 +1214,7 @@ utils: $(PERLEXE) $(X2P)
        $(PERLEXE) $(PL2BAT) $(UTILS)
 
 distclean: clean
-       -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
+       -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
                $(PERLIMPLIB) ..\miniperl$(a) $(MINIMOD)
        -del /f *.def *.map
        -del /f $(EXTENSION_DLL) $(EXTENSION_PM)
@@ -1259,9 +1240,6 @@ distclean: clean
        -cd ..\x2p && del /f find2perl s2p *.bat
        -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
        -del /f $(CONFIGPM)
-.IF "$(PERL95EXE)" != ""
-       -del /f perl95.c
-.ENDIF
        -del /f bin\*.bat
        -cd $(EXTDIR) && del /s *$(a) *.def *.map *.pdb *.bs Makefile *$(o) \
            pm_to_blib
@@ -1272,9 +1250,6 @@ install : all installbare installhtml
 
 installbare : $(RIGHTMAKE) utils
        $(PERLEXE) ..\installperl
-.IF "$(PERL95EXE)" != ""
-       $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
-.ENDIF
        if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\*.*
        $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
        $(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*