#DEBUG_MSTATS *= define
#
+# set this to additionally provide a statically linked perl-static.exe.
+# Note that dynamic loading will not work with this perl, so you must
+# include required modules statically using STATIC_EXT variable below.
+# A static library perl59s.lib will also be created.
+# Ordinary perl.exe is not affected by this option.
+#
+#BUILD_STATIC *= define
+
+#
# set the install locations of the compiler include/libraries
# Running VCVARS32.BAT is *required* when using Visual C.
# Some versions of Visual C don't define MSVCDIR in the environment,
.ELSE
LINK32 = tlink32
.ENDIF
-LIB32 = tlib /P128
+LIB32 = tlib /a /P128
IMPLIB = implib -c
RSC = brcc32
LINK_FLAGS = -nologo -nodefaultlib $(LINK_DBG) \
-libpath:"$(INST_COREDIR)" \
-machine:$(PROCESSOR_ARCHITECTURE)
+LIB_FLAGS = -nologo
OBJOUT_FLAG = -Fo
EXEOUT_FLAG = -Fe
LIBOUT_FLAG = /out:
MINIDIR = .\mini
PERLEXE = ..\perl.exe
WPERLEXE = ..\wperl.exe
+PERLEXESTATIC = ..\perl-static.exe
GLOBEXE = ..\perlglob.exe
CONFIGPM = ..\lib\Config.pm ..\lib\Config_heavy.pl
MINIMOD = ..\lib\ExtUtils\Miniperl.pm
X2P = ..\x2p\a2p.exe
+.IF "$(BUILD_STATIC)" == "define"
+PERLSTATIC = static
+.ELSE
+PERLSTATIC =
+.ENDIF
# Unicode data files generated by mktables
UNIDATAFILES = ..\lib\unicore\Canonical.pl ..\lib\unicore\Exact.pl \
CFGSH_TMPL = config.gc
CFGH_TMPL = config_H.gc
PERLIMPLIB = ..\libperl59$(a)
+PERLSTATICLIB = ..\libperl59s$(a)
.ELSE
# makedef.pl must be updated if this changes, and this should normally
# only change when there is an incompatible revision of the public API.
PERLIMPLIB *= ..\perl59$(a)
+PERLSTATICLIB *= ..\perl59s$(a)
PERLDLL = ..\perl59.dll
XCOPY = xcopy /f /r /i /d /y
PERLDLL_OBJ = $(CORE_OBJ)
PERLEXE_OBJ = perlmain$(o)
+PERLEXEST_OBJ = perlmainst$(o)
PERLDLL_OBJ += $(WIN32_OBJ) $(DLL_OBJ)
all : .\config.h $(GLOBEXE) $(MINIPERL) $(MK2) \
$(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \
- $(X2P) MakePPPort Extensions
+ $(X2P) MakePPPort Extensions $(PERLSTATIC)
reonly : .\config.h $(GLOBEXE) $(MINIPERL) $(MK2) \
$(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \
$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
+static: $(PERLEXESTATIC)
+
#----------------------------------------------------------------
#-------------------- BEGIN Win95 SPECIFIC ----------------------
.ENDIF
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
+$(PERLSTATICLIB): Extensions_static
+.IF "$(CCTYPE)" == "BORLAND"
+ $(LIB32) $(LIB_FLAGS) $@ \
+ @$(mktmp $(subst,\,$B $(shell @type Extensions_static)) \
+ $(PERLDLL_OBJ:s,\,$B,))
+.ELIF "$(CCTYPE)" == "GCC"
+# XXX: It would be nice if MinGW's ar accepted a temporary file, but this
+# doesn't seem to work:
+# $(LIB32) $(LIB_FLAGS) $@ \
+# $(mktmp $(LKPRE) $(subst,\,$B $(shell @type Extensions_static)) \
+# $(PERLDLL_OBJ:s,\,$B,) $(LKPOST))
+ $(LIB32) $(LIB_FLAGS) $@ \
+ $(subst,\,$B $(shell @type Extensions_static)) \
+ $(PERLDLL_OBJ:s,\,$B,)
+.ELSE
+ $(LIB32) $(LIB_FLAGS) -out:$@ @Extensions_static \
+ @$(mktmp $(PERLDLL_OBJ:s,\,$B,))
+.ENDIF
+ $(XCOPY) $(PERLSTATICLIB) $(COREDIR)
$(PERLEXE_ICO): $(MINIPERL) makeico.pl
$(MINIPERL) makeico.pl > $@
perlmain$(o) : perlmain.c
$(CC) $(CFLAGS_O) -UPERLDLL $(OBJOUT_FLAG)$@ -c perlmain.c
+perlmainst.c : runperl.c
+ copy runperl.c perlmainst.c
+
+perlmainst$(o) : perlmainst.c
+ $(CC) $(CFLAGS_O) -DPERLDLL $(OBJOUT_FLAG)$@ -c perlmainst.c
+
$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
.IF "$(CCTYPE)" == "BORLAND"
$(LINK32) -Tpe -ap $(BLINK_FLAGS) \
copy splittree.pl ..
$(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
+$(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES)
+.IF "$(CCTYPE)" == "BORLAND"
+ $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
+ @$(mktmp c0x32$(o) $(PERLEXEST_OBJ:s,\,$B,)$N \
+ $(@:s,\,$B,),$N \
+ $(subst,\,$B $(shell @type Extensions_static)) \
+ $(PERLSTATICLIB) $(LIBFILES)$N)
+.ELIF "$(CCTYPE)" == "GCC"
+ $(LINK32) -mconsole -o $@ $(BLINK_FLAGS) \
+ $(mktmp $(LKPRE) $(subst,\,$B $(shell @type Extensions_static)) \
+ $(PERLSTATICLIB) $(LIBFILES) $(PERLEXEST_OBJ) $(LKPOST))
+.ELSE
+ $(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(BLINK_FLAGS) \
+ @Extensions_static $(PERLSTATICLIB) \
+ $(LIBFILES) $(PERLEXEST_OBJ) $(SETARGV_OBJ) $(PERLEXE_RES)
+ $(EMBED_EXE_MANI)
+.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
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re
-Extensions_static : buildext.pl
+Extensions_static : buildext.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static
distclean: realclean
-del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
- $(PERLIMPLIB) ..\miniperl$(a) $(MINIMOD)
+ $(PERLIMPLIB) ..\miniperl$(a) $(MINIMOD) \
+ $(PERLEXESTATIC) $(PERLSTATICLIB)
-del /f *.def *.map
-del /f $(DYNALOADER).c
-del /f $(EXTDIR)\DynaLoader\dl_win32.xs
perldoc perlivp dprofpp libnetcfg enc2xs piconv cpan *.bat \
xsubpp instmodsh prove ptar ptardiff shasum corelist config_data
-cd ..\x2p && del /f find2perl s2p psed *.bat
- -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
+ -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new \
+ perlmainst.c
-del /f $(CONFIGPM)
-del /f bin\*.bat
-del /f perllibst.h
-@erase $(MINIPERL)
-@erase perlglob$(o)
-@erase perlmain$(o)
+ -@erase perlmainst$(o)
-@erase config.w32
-@erase /f config.h
-@erase $(GLOBEXE)
-@erase $(PERLEXE)
-@erase $(WPERLEXE)
+ -@erase $(PERLEXESTATIC)
+ -@erase $(PERLSTATICLIB)
-@erase $(PERLDLL)
-@erase $(CORE_OBJ)
-if exist $(MINIDIR) rmdir /s /q $(MINIDIR)