Perl Social Contract
[p5sagit/p5-mst-13.2.git] / win32 / makefile.mk
index aed9f59..6fc9005 100644 (file)
@@ -17,7 +17,7 @@ INST_TOP      *= $(INST_DRV)\perl5004.5x
 
 #
 # uncomment to enable threads-capabilities
-#USE_THREADS   *= -DUSE_THREADS
+#USE_THREADS   *= define
 
 #
 # uncomment one
@@ -41,6 +41,13 @@ CCTYPE               *= BORLAND
 #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.
+PERL_MALLOC    *= define
+
+#
 # set the install locations of the compiler include/libraries
 #CCHOME                *= f:\msdev\vc
 CCHOME         *= C:\bc5
@@ -67,19 +74,26 @@ D_CRYPT=define
 CRYPT_FLAG=-DHAVE_DES_FCRYPT
 .ENDIF
 
-BUILDOPT       *= $(USE_THREADS)
-#BUILDOPT      *= $(USE_THREADS) -DMULTIPLICITY 
-#BUILDOPT      *= $(USE_THREADS) -DPERL_GLOBAL_STRUCT -DMULTIPLICITY 
+.IF "$(PERL_MALLOC)" == ""
+PERL_MALLOC    *= undef
+.ENDIF
+
+#BUILDOPT      *= -DMULTIPLICITY 
+#BUILDOPT      *= -DPERL_GLOBAL_STRUCT -DMULTIPLICITY 
 # -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include
 
+.IF "$(USE_THREADS)" == ""
+USE_THREADS    = undef
+.ENDIF
+
 .IMPORT .IGNORE : PROCESSOR_ARCHITECTURE
 
 PROCESSOR_ARCHITECTURE *= x86
 
-.IF "$(USE_THREADS)" == ""
-ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)
-.ELSE
+.IF "$(USE_THREADS)" == "define"
 ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)-thread
+.ELSE
+ARCHNAME       = MSWin32-$(PROCESSOR_ARCHITECTURE)
 .ENDIF
 
 ARCHDIR                = ..\lib\$(ARCHNAME)
@@ -103,7 +117,7 @@ IMPLIB = implib -c
 #
 RUNTIME  = -D_RTLDLL
 INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR)
-#PCHFLAGS = -H -H$(INTDIR)\bcmoduls.pch 
+#PCHFLAGS = -H -Hc -H=c:\temp\bcmoduls.pch 
 DEFINES  = -DWIN32 $(BUILDOPT) $(CRYPT_FLAG)
 LOCDEFS  = -DPERLDLL -DPERL_CORE
 SUBSYS   = console
@@ -143,8 +157,8 @@ DEFINES  = -DWIN32 $(BUILDOPT) $(CRYPT_FLAG)
 LOCDEFS  = -DPERLDLL -DPERL_CORE
 SUBSYS   = console
 LIBC    = -lcrtdll
-LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lwsock32 -lmingw32 -lgcc -lmoldname $(LIBC) \
-               -lkernel32
+LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lnetapi32 -lwsock32 -lmingw32 \
+       -lgcc -lmoldname $(LIBC) -lkernel32
 
 WINIOMAYBE =
 
@@ -173,7 +187,7 @@ LIB32=$(LINK32) -lib
 RUNTIME  = -MD
 .ENDIF
 INCLUDES = -I.\include -I. -I..
-#PCHFLAGS = -Fp$(INTDIR)\vcmoduls.pch -YX 
+#PCHFLAGS = -Fpc:\temp\vcmoduls.pch -YX 
 DEFINES  = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG)
 LOCDEFS  = -DPERLDLL -DPERL_CORE
 SUBSYS   = console
@@ -280,7 +294,6 @@ CFGH_TMPL = config_H.gc
 
 .ELSE
 
-MAKE = nmake -nologo
 CFGSH_TMPL = config.vc
 CFGH_TMPL = config_H.vc
 PERL95EXE=..\perl95.exe
@@ -296,12 +309,18 @@ NOOP=@echo
 CRYPT_OBJ=$(CRYPT_SRC:db:+$(o))
 .ENDIF
 
+.IF "$(PERL_MALLOC)" == "define"
+MALLOC_SRC     = ..\malloc.c
+MALLOC_OBJ     = ..\malloc$(o)
+.ENDIF
+
 #
 # filenames given to xsubpp must have forward slashes (since it puts
 # full pathnames in #line strings)
 XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
 
 CORE_C=        ..\av.c         \
+       ..\byterun.c    \
        ..\deb.c        \
        ..\doio.c       \
        ..\doop.c       \
@@ -327,10 +346,11 @@ CORE_C=   ..\av.c         \
        ..\toke.c       \
        ..\universal.c  \
        ..\util.c       \
-       ..\malloc.c     \
+       $(MALLOC_SRC)   \
        $(CRYPT_SRC)
 
 CORE_OBJ= ..\av$(o)    \
+       ..\byterun$(o)  \
        ..\deb$(o)      \
        ..\doio$(o)     \
        ..\doop$(o)     \
@@ -356,7 +376,7 @@ CORE_OBJ= ..\av$(o) \
        ..\toke$(o)     \
        ..\universal$(o)\
        ..\util$(o)     \
-       ..\malloc$(o)   \
+       $(MALLOC_OBJ)   \
        $(CRYPT_OBJ)
 
 WIN32_C = perllib.c \
@@ -382,6 +402,8 @@ X2P_OBJ = ..\x2p\a2p$(o)    \
        ..\x2p\walk$(o)
 
 CORE_H = ..\av.h       \
+       ..\byterun.h    \
+       ..\bytecode.h   \
        ..\cop.h        \
        ..\cv.h         \
        ..\dosish.h     \
@@ -418,7 +440,7 @@ CORE_H = ..\av.h    \
        .\include\sys\socket.h  \
        .\win32.h
 
-DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread
+DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread B
 STATIC_EXT=DynaLoader
 
 DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
@@ -429,6 +451,7 @@ SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
 IO=$(EXTDIR)\IO\IO
 ATTRS=$(EXTDIR)\attrs\attrs
 THREAD=$(EXTDIR)\Thread\Thread
+B=$(EXTDIR)\B\B
 
 SOCKET_DLL=..\lib\auto\Socket\Socket.dll
 FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
@@ -437,6 +460,7 @@ SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
 IO_DLL=..\lib\auto\IO\IO.dll
 ATTRS_DLL=..\lib\auto\attrs\attrs.dll
 THREAD_DLL=..\lib\auto\Thread\Thread.dll
+B_DLL=..\lib\auto\B\B.dll
 
 STATICLINKMODULES=DynaLoader
 DYNALOADMODULES=       \
@@ -446,13 +470,33 @@ DYNALOADMODULES=  \
        $(SDBM_FILE_DLL)\
        $(IO_DLL)       \
        $(ATTRS_DLL)    \
-       $(THREAD_DLL)
+       $(THREAD_DLL)   \
+       $(B_DLL)
 
 POD2HTML=$(PODDIR)\pod2html
 POD2MAN=$(PODDIR)\pod2man
 POD2LATEX=$(PODDIR)\pod2latex
 POD2TEXT=$(PODDIR)\pod2text
 
+CFG_VARS=   "INST_DRV=$(INST_DRV)"             \
+           "INST_TOP=$(INST_TOP)"              \
+           "archname=$(ARCHNAME)"              \
+           "cc=$(CC)"                          \
+           "ccflags=$(OPTIMIZE) $(DEFINES)"    \
+           "cf_email=$(EMAIL)"                 \
+           "d_crypt=$(D_CRYPT)"                \
+           "d_mymalloc=$(PERL_MALLOC)"         \
+           "libs=$(LIBFILES:f)"                \
+           "incpath=$(CCINCDIR)"               \
+           "libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" \
+           "libc=$(LIBC)"                      \
+           "make=dmake"                        \
+           "static_ext=$(STATIC_EXT)"          \
+           "dynamic_ext=$(DYNAMIC_EXT)"        \
+           "usethreads=$(USE_THREADS)"         \
+           "LINK_FLAGS=$(LINK_FLAGS)"          \
+           "optimize=$(OPTIMIZE)"
+
 #
 # Top targets
 #
@@ -488,23 +532,19 @@ config.w32 : $(CFGSH_TMPL)
        copy $(CFGH_TMPL) config.h
 
 ..\config.sh : config.w32 $(MINIPERL) config_sh.PL
-       $(MINIPERL) -I..\lib config_sh.PL       \
-           "INST_DRV=$(INST_DRV)"              \
-           "INST_TOP=$(INST_TOP)"              \
-           "archname=$(ARCHNAME)"              \
-           "cc=$(CC)"                          \
-           "ccflags=$(OPTIMIZE) $(DEFINES)"    \
-           "cf_email=$(EMAIL)"                 \
-           "d_crypt=$(D_CRYPT)"                \
-           "libs=$(LIBFILES:f)"                \
-           "incpath=$(CCINCDIR)"               \
-           "libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" \
-           "libc=$(LIBC)"                      \
-           "static_ext=$(STATIC_EXT)"          \
-           "dynamic_ext=$(DYNAMIC_EXT)"        \
-           "LINK_FLAGS=$(LINK_FLAGS)"          \
-           "optimize=$(OPTIMIZE)"              \
-           config.w32                          > ..\config.sh
+       $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh
+
+# 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`)
+regen_config_h:
+       perl config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
+       -cd .. && del /f perl.exe
+       cd .. && perl configpm
+       -del /f $(CFGH_TMPL)
+       -mkdir ..\lib\CORE
+       -perl -I..\lib config_h.PL
+       rename config.h $(CFGH_TMPL)
 
 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
        cd .. && miniperl configpm
@@ -512,8 +552,7 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
        $(XCOPY) ..\*.h $(COREDIR)\*.*
        $(XCOPY) *.h $(COREDIR)\*.*
        $(RCOPY) include $(COREDIR)\*.*
-       $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) \
-           CFG=$(CFG) $(CONFIGPM)
+       $(MINIPERL) -I..\lib config_h.PL || $(MAKE) $(MAKEMACROS) $(CONFIGPM)
 
 LKPRE = INPUT (
 LKPOST = )
@@ -587,7 +626,7 @@ $(X2P) : $(X2P_OBJ)
            $(mktmp $(LKPRE) $(X2P_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
 .ELSE
        $(LINK32) -subsystem:console -out:$@ \
-           @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\)
+           @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\))
 .ENDIF
 
 perlmain.c : runperl.c 
@@ -643,6 +682,11 @@ $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
        copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
 
+$(B_DLL): $(PERLEXE) $(B).xs
+       cd $(EXTDIR)\$(*B) && \
+       ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+       cd $(EXTDIR)\$(*B) && $(MAKE)
+
 $(THREAD_DLL): $(PERLEXE) $(THREAD).xs
        cd $(EXTDIR)\$(*B) && \
        ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
@@ -684,7 +728,7 @@ doc: $(PERLEXE)
        cd ..\pod && $(XCOPY) *.bat ..\win32\bin\*.*
        copy ..\README.win32 ..\pod\perlwin32.pod
        $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=./html \
-           --podpath=pod:lib:ext:utils --htmlroot="//$(INST_HTML:s,:,|,)" \
+           --podpath=pod:lib:ext:utils --htmlroot="file://$(INST_HTML:s,:,|,)"\
            --libpod=perlfunc:perlguts:perlvar:perlrun:perlop --recurse
 
 utils: $(PERLEXE)
@@ -700,9 +744,9 @@ distclean: clean
                $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
        -del /f *.def *.map
        -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
-               $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL)
+               $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL)
        -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
-               $(DYNALOADER).c $(ATTRS).c $(THREAD).c
+               $(DYNALOADER).c $(ATTRS).c $(THREAD).c $(B).c
        -del /f $(PODDIR)\*.html
        -del /f $(PODDIR)\*.bat
        -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new