Abolish USE_WIN32_RTL_ENV.
[p5sagit/p5-mst-13.2.git] / win32 / Makefile
index af11990..9049099 100644 (file)
@@ -1,8 +1,10 @@
 #
 # Makefile to build perl on Windows NT using Microsoft NMAKE.
+# Supported compilers:
+#      Visual C++ 5.x (possibly other versions)
 #
 # This is set up to build a perl.exe that runs off a shared library
-# (perl56.dll).  Also makes individual DLLs for the XS extensions.
+# (perl57.dll).  Also makes individual DLLs for the XS extensions.
 #
 
 ##
@@ -29,7 +31,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.6.0
+#INST_VER = \5.7.0
 
 #
 # Comment this out if you DON'T want your perl installation to have
@@ -40,27 +42,31 @@ INST_VER    = \5.6.0
 # the same location.  Commenting it out gives you a simpler
 # installation that is easier to understand for beginners.
 #
-INST_ARCH      = \$(ARCHNAME)
+#INST_ARCH = \$(ARCHNAME)
 
 #
 # uncomment to enable multiple interpreters.  This is need for fork()
 # emulation.
 #
-#USE_MULTI     = define
+USE_MULTI = define
 
 #
 # Beginnings of interpreter cloning/threads; still very incomplete.
 # This should be enabled to get the fork() emulation.  This needs
 # USE_MULTI as well.
 #
-#USE_ITHREADS  = define
+USE_ITHREADS = define
 
 #
 # 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_IMP_SYS   = define
+USE_IMP_SYS = define
+
+#
+# uncomment to enable the experimental PerlIO I/O subsystem.
+USE_PERLIO     = define
 
 #
 # WARNING! This option is deprecated and will eventually go away (enable
@@ -70,7 +76,7 @@ INST_ARCH     = \$(ARCHNAME)
 # 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_5005THREADS= define
+#USE_5005THREADS       = define
 
 #
 # WARNING! This option is deprecated and will eventually go away (enable
@@ -239,6 +245,10 @@ USE_ITHREADS       = undef
 USE_IMP_SYS    = undef
 !ENDIF
 
+!IF "$(USE_PERLIO)" == ""
+USE_PERLIO     = undef
+!ENDIF
+
 !IF "$(USE_PERLCRT)" == ""
 USE_PERLCRT    = undef
 !ENDIF
@@ -273,10 +283,18 @@ ARCHNAME  = MSWin32-$(PROCESSOR_ARCHITECTURE)-thread
 !IF "$(USE_MULTI)" == "define"
 ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)-multi
 !ELSE
+!IF "$(USE_PERLIO)" == "define"
+ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)-perlio
+!ELSE
 ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)
 !ENDIF
 !ENDIF
 !ENDIF
+!ENDIF
+
+!IF "$(USE_PERLIO)" == "define"
+BUILDOPT       = $(BUILDOPT) -DUSE_PERLIO
+!ENDIF
 
 !IF "$(USE_ITHREADS)" == "define"
 ARCHNAME       = $(ARCHNAME)-thread
@@ -287,13 +305,7 @@ ARCHNAME   = $(ARCHNAME)-thread
 
 # VC 6.0 can load the socket dll on demand.  Makes the test suite
 # run in about 10% less time.
-DELAYLOAD      = -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib 
-
-# VC 6.0 seems capable of compiling perl correctly with optimizations
-# enabled.  Anything earlier fails tests.
-!IF "$(CFG)" == ""
-CFG            = Optimize
-!ENDIF
+DELAYLOAD      = -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib
 !ENDIF
 
 ARCHDIR                = ..\lib\$(ARCHNAME)
@@ -311,7 +323,7 @@ INST_LIB    = $(INST_TOP)$(INST_VER)\lib
 INST_ARCHLIB   = $(INST_LIB)$(INST_ARCH)
 INST_COREDIR   = $(INST_ARCHLIB)\CORE
 INST_POD       = $(INST_LIB)\pod
-INST_HTML      = $(INST_POD)\html
+INST_HTML      = $(INST_TOP)$(INST_VER)\html
 
 #
 # Programs to compile, build .lib files and link
@@ -327,7 +339,7 @@ RSC         = rc
 #
 
 INCLUDES       = -I$(COREDIR) -I.\include -I. -I..
-#PCHFLAGS      = -Fpc:\temp\vcmoduls.pch -YX 
+#PCHFLAGS      = -Fpc:\temp\vcmoduls.pch -YX
 DEFINES                = -DWIN32 -D_CONSOLE -DNO_STRICT $(CRYPT_FLAG)
 LOCDEFS                = -DPERLDLL -DPERL_CORE
 SUBSYS         = console
@@ -350,13 +362,9 @@ OPTIMIZE   = -Od -MD -Zi -DDEBUGGING
 !  ENDIF
 LINK_DBG       = -debug -pdb:none
 !ELSE
-!  IF  "$(CFG)" == "Optimize"
 # -O1 yields smaller code, which turns out to be faster than -O2
 #OPTIMIZE      = -O2 -MD -DNDEBUG
 OPTIMIZE       = -O1 -MD -DNDEBUG
-!  ELSE
-OPTIMIZE       = -Od -MD -DNDEBUG
-!  ENDIF
 LINK_DBG       = -release
 !ENDIF
 
@@ -395,7 +403,7 @@ o = .obj
 
 #
 # Rules
-# 
+#
 
 .SUFFIXES : .c $(o) .dll .lib .exe .rc .res
 
@@ -407,15 +415,19 @@ o = .obj
 
 $(o).dll:
        $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
-           -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)  
+           -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
 
 .rc.res:
        $(RSC) -i.. $<
 
 #
 # various targets
-PERLIMPLIB     = ..\perl56.lib
-PERLDLL                = ..\perl56.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.
+# XXX so why did we change it from perl56 to perl57?
+PERLIMPLIB     = ..\perl57.lib
+PERLDLL                = ..\perl57.dll
 
 MINIPERL       = ..\miniperl.exe
 MINIDIR                = .\mini
@@ -465,6 +477,8 @@ RCOPY               = xcopy /f /r /i /e /d
 NOOP           = @echo
 NULL           =
 
+DEL            = bin\mdelete.bat
+
 #
 # filenames given to xsubpp must have forward slashes (since it puts
 # full pathnames in #line strings)
@@ -514,7 +528,7 @@ EXTRACORE_SRC       = $(EXTRACORE_SRC) ..\perlio.c
 WIN32_SRC      =               \
                .\win32.c       \
                .\win32sck.c    \
-               .\win32thread.c 
+               .\win32thread.c
 
 !IF "$(CRYPT_SRC)" != ""
 WIN32_SRC      = $(WIN32_SRC) .\$(CRYPT_SRC)
@@ -594,7 +608,7 @@ SETARGV_OBJ = setargv$(o)
 
 DYNAMIC_EXT    = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B re \
                Data/Dumper Devel/Peek ByteLoader Devel/DProf File/Glob \
-               Sys/Hostname Storable
+               Sys/Hostname Storable Filter/Util/Call Encode
 STATIC_EXT     = DynaLoader
 NONXS_EXT      = Errno
 
@@ -617,6 +631,8 @@ DPROF               = $(EXTDIR)\Devel\DProf\DProf
 GLOB           = $(EXTDIR)\File\Glob\Glob
 HOSTNAME       = $(EXTDIR)\Sys\Hostname\Hostname
 STORABLE       = $(EXTDIR)\Storable\Storable
+FILTER         = $(EXTDIR)\Filter\Util\Call\Call
+ENCODE         = $(EXTDIR)\Encode\Encode
 
 SOCKET_DLL     = $(AUTODIR)\Socket\Socket.dll
 FCNTL_DLL      = $(AUTODIR)\Fcntl\Fcntl.dll
@@ -635,6 +651,8 @@ DPROF_DLL   = $(AUTODIR)\Devel\DProf\DProf.dll
 GLOB_DLL       = $(AUTODIR)\File\Glob\Glob.dll
 HOSTNAME_DLL   = $(AUTODIR)\Sys\Hostname\Hostname.dll
 STORABLE_DLL   = $(AUTODIR)\Storable\Storable.dll
+FILTER_DLL     = $(AUTODIR)\Filter\Util\Call\Call.dll
+ENCODE_DLL     = $(AUTODIR)\Encode\Encode.dll
 
 ERRNO_PM       = $(LIBDIR)\Errno.pm
 
@@ -655,7 +673,9 @@ EXTENSION_C =               \
                $(DPROF).c      \
                $(GLOB).c       \
                $(HOSTNAME).c   \
-               $(STORABLE).c
+               $(STORABLE).c   \
+               $(FILTER).c     \
+               $(ENCODE).c     
 
 EXTENSION_DLL  =               \
                $(SOCKET_DLL)   \
@@ -674,7 +694,9 @@ EXTENSION_DLL       =               \
                $(DPROF_DLL)    \
                $(GLOB_DLL)     \
                $(HOSTNAME_DLL) \
-               $(STORABLE_DLL)
+               $(STORABLE_DLL) \
+               $(FILTER_DLL)   \
+               $(ENCODE_DLL)
 
 EXTENSION_PM   =               \
                $(ERRNO_PM)
@@ -691,8 +713,9 @@ CFG_VARS    =                                       \
                "INST_ARCH=$(INST_ARCH)"                \
                "archname=$(ARCHNAME)"                  \
                "cc=$(CC)"                              \
-               "ccflags=$(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)"       \
-               "cf_email=$(EMAIL)"                     \
+               "ld=$(LINK32)"                          \
+               "ccflags=-nologo -Gf -W3 $(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)"       \
+               "cf_email=$(EMAIL)"                     \
                "d_crypt=$(D_CRYPT)"                    \
                "d_mymalloc=$(PERL_MALLOC)"             \
                "libs=$(LIBFILES)"                      \
@@ -708,6 +731,7 @@ CFG_VARS    =                                       \
                "useithreads=$(USE_ITHREADS)"           \
                "usethreads=$(USE_5005THREADS)"         \
                "usemultiplicity=$(USE_MULTI)"          \
+               "useperlio=$(USE_PERLIO)"               \
                "LINK_FLAGS=$(LINK_FLAGS:"=\")"         \
                "optimize=$(OPTIMIZE:"=\")"
 
@@ -724,7 +748,7 @@ $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
 $(GLOBEXE) : perlglob$(o)
        $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
-           perlglob$(o) setargv$(o) 
+           perlglob$(o) setargv$(o)
 
 perlglob$(o)  : perlglob.c
 
@@ -740,7 +764,7 @@ config.w32 : $(CFGSH_TMPL)
 
 # this target is for when changes to the main config.sh happen
 # edit config.{b,v,g}c and make this target once for each supported
-# compiler (e.g. `dmake CCTYPE=BORLAND regen_config_h`)
+# compiler (e.g. `nmake CCTYPE=BORLAND regen_config_h`)
 regen_config_h:
        perl config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
        cd ..
@@ -753,14 +777,16 @@ regen_config_h:
        rename config.h $(CFGH_TMPL)
 
 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
-       cd .. && miniperl configpm
+       cd ..
+       miniperl configpm
+       cd win32
        if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
        $(XCOPY) ..\*.h $(COREDIR)\*.*
        $(XCOPY) *.h $(COREDIR)\*.*
        $(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.*
        $(RCOPY) include $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" \
-           || $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
+       -$(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)"
+       if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
 
 $(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
        $(LINK32) -subsystem:console -out:$@ @<<
@@ -803,7 +829,9 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES)
        $(XCOPY) $(PERLIMPLIB) $(COREDIR)
 
 $(MINIMOD) : $(MINIPERL) ..\minimod.pl
-       cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
+       cd ..
+       miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
+       cd win32
 
 ..\x2p\a2p$(o) : ..\x2p\a2p.c
        $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
@@ -827,7 +855,7 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ)
                $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ)
 <<
 
-perlmain.c : runperl.c 
+perlmain.c : runperl.c
        copy runperl.c perlmain.c
 
 perlmain$(o) : perlmain.c
@@ -838,7 +866,7 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
            $(LIBFILES) $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES)
        copy $(PERLEXE) $(WPERLEXE)
        $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS
-       copy splittree.pl .. 
+       copy splittree.pl ..
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
 
 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
@@ -952,12 +980,30 @@ $(BYTELOADER_DLL): $(PERLEXE) $(BYTELOADER).xs
        $(MAKE)
        cd ..\..\win32
 
+$(ENCODE_DLL): $(PERLEXE) $(ENCODE).xs
+       cd $(EXTDIR)\$(*B)
+       ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+       $(MAKE)
+       cd ..\..\win32
+
 $(STORABLE_DLL): $(PERLEXE) $(STORABLE).xs
        cd $(EXTDIR)\$(*B)
        ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
        $(MAKE)
        cd ..\..\win32
 
+$(FILTER_DLL): $(PERLEXE) $(FILTER).xs
+       cd $(EXTDIR)\Filter\Util\Call
+       ..\..\..\..\miniperl -I..\..\..\..\lib Makefile.PL INSTALLDIRS=perl
+       $(MAKE)
+       cd ..\..\..\..\win32
+
+$(ENCODE_DLL): $(PERLEXE) $(ENCODE).xs
+       cd $(EXTDIR)\$(*B)
+       ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+       $(MAKE)
+       cd ..\..\win32
+
 $(ERRNO_PM): $(PERLEXE) $(ERRNO)_pm.PL
        cd $(EXTDIR)\$(*B)
        ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
@@ -973,13 +1019,20 @@ utils: $(PERLEXE) $(X2P)
        cd ..\utils
        $(MAKE) PERL=$(MINIPERL)
        cd ..\pod
+       copy ..\README.aix .\perlaix.pod
        copy ..\README.amiga .\perlamiga.pod
        copy ..\README.cygwin .\perlcygwin.pod
        copy ..\README.dos .\perldos.pod
+       copy ..\README.epoc .\perlepoc.pod
        copy ..\README.hpux .\perlhpux.pod
        copy ..\README.machten .\perlmachten.pod
        copy ..\README.os2 .\perlos2.pod
+       copy ..\README.os390 .\perlos390.pod
+       copy ..\README.vmesa .\perlvmesa.pod
+       copy ..\README.bs2000 .\perlbs2000.pod
+       copy ..\README.solaris .\perlsolaris.pod
        copy ..\vms\perlvms.pod .\perlvms.pod
+       copy ..\README.vos .\perlvos.pod
        copy ..\README.win32 .\perlwin32.pod
        $(MAKE) -f ..\win32\pod.mak converters
        cd ..\lib
@@ -1004,10 +1057,17 @@ distclean: clean
        -del /f $(LIBDIR)\Devel\Peek.pm $(LIBDIR)\Devel\DProf.pm
        -del /f $(LIBDIR)\File\Glob.pm
        -del /f $(LIBDIR)\Storable.pm
-       -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO || rmdir /s $(LIBDIR)\IO
-       -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread || rmdir /s $(LIBDIR)\Thread
-       -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B || rmdir /s $(LIBDIR)\B
-       -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data || rmdir /s $(LIBDIR)\Data
+       -del /f $(LIBDIR)\Filter\Util\Call\Call.pm
+       -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
+       -rmdir /s $(LIBDIR)\IO
+       -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
+       -rmdir /s $(LIBDIR)\Thread
+       -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B
+       -rmdir /s $(LIBDIR)\B
+       -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
+       -rmdir /s $(LIBDIR)\Data
+       -if exist $(LIBDIR)\Filter\Util\Call rmdir /s /q $(LIBDIR)\Filter\Util\Call
+       -if exist $(LIBDIR)\Filter\Util rmdir /s /q $(LIBDIR)\Filter\Util
        -del /f $(PODDIR)\*.html
        -del /f $(PODDIR)\*.bat
        cd ..\utils
@@ -1024,8 +1084,10 @@ distclean: clean
        cd $(EXTDIR)
        -del /s *.lib *.def *.map *.pdb *.bs Makefile *$(o) pm_to_blib
        cd ..\win32
-       -if exist $(AUTODIR) rmdir /s /q $(AUTODIR) || rmdir /s $(AUTODIR)
-       -if exist $(COREDIR) rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR)
+       -if exist $(AUTODIR) rmdir /s /q $(AUTODIR)
+       -rmdir /s $(AUTODIR)
+       -if exist $(COREDIR) rmdir /s /q $(COREDIR)
+       -rmdir /s $(COREDIR)
 
 install : all installbare installhtml
 
@@ -1039,7 +1101,7 @@ installhtml : doc
        $(RCOPY) html\*.* $(INST_HTML)\*.*
 
 inst_lib : $(CONFIGPM)
-       copy splittree.pl .. 
+       copy splittree.pl ..
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
        $(RCOPY) ..\lib $(INST_LIB)\*.*
 
@@ -1081,28 +1143,29 @@ test-wide-notty : test-prep
        $(PERLEXE) -I..\lib harness
        cd ..\win32
 
-clean : 
-       -@erase miniperlmain$(o)
-       -@erase $(MINIPERL)
-       -@erase perlglob$(o)
-       -@erase perlmain$(o)
-       -@erase config.w32
-       -@erase /f config.h
-       -@erase $(GLOBEXE)
-       -@erase $(PERLEXE)
-       -@erase $(WPERLEXE)
-       -@erase $(PERLDLL)
-       -@erase $(CORE_OBJ)
-       -if exist $(MINIDIR) rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR)
-       -@erase $(WIN32_OBJ)
-       -@erase $(DLL_OBJ)
-       -@erase $(X2P_OBJ)
-       -@erase ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res
-       -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
-       -@erase ..\x2p\*.exe ..\x2p\*.bat
-       -@erase *.ilk
-       -@erase *.pdb
+clean :
+       -@$(DEL) miniperlmain$(o)
+       -@$(DEL) $(MINIPERL)
+       -@$(DEL) perlglob$(o)
+       -@$(DEL) perlmain$(o)
+       -@$(DEL) config.w32
+       -@$(DEL) /f config.h
+       -@$(DEL) $(GLOBEXE)
+       -@$(DEL) $(PERLEXE)
+       -@$(DEL) $(WPERLEXE)
+       -@$(DEL) $(PERLDLL)
+       -@$(DEL) $(CORE_OBJ)
+       -if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
+       -rmdir /s $(MINIDIR)
+       -@$(DEL) $(WIN32_OBJ)
+       -@$(DEL) $(DLL_OBJ)
+       -@$(DEL) $(X2P_OBJ)
+       -@$(DEL) ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res
+       -@$(DEL) ..\t\*.exe ..\t\*.dll ..\t\*.bat
+       -@$(DEL) ..\x2p\*.exe ..\x2p\*.bat
+       -@$(DEL) *.ilk
+       -@$(DEL) *.pdb
+
 # Handy way to run perlbug -ok without having to install and run the
 # installed perlbug. We don't re-run the tests here - we trust the user.
 # Please *don't* use this unless all tests pass.
@@ -1112,9 +1175,9 @@ ok: utils
 
 okfile: utils
        $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
+
 nok: utils
        $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)"
+
 nokfile: utils
        $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok