summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-07-08 17:00:35 +0200
committerNicholas Clark <nick@ccl4.org>2013-07-09 07:54:34 +0200
commitb49998889df0e37bdd1b5d4d49c8a1adcb0eedbb (patch)
tree8b7b4b4e36711620954aa8ee29b87e1f92b3d4b5
parenta06cd52b4e4376cb0c4375a8943888ed7c9f37d2 (diff)
downloadperl-b49998889df0e37bdd1b5d4d49c8a1adcb0eedbb.tar.gz
Change the *nix and VMS Makefiles to to pass a filename to writemain().
Adding a first argument as a reference to the filename "perlmain.c" makes ExtUtils::Miniperl::writemain() open and close the file for us. This is safer than having the Makefile create the file using output redirection as that can create an empty file if compilation aborts. This change means that the file is only moved into place with the correct name if it has been written completely without error. If an error happens the file is not created, the make aborts, and any subsequent make will re-attempt to create the file, instead of continuing with an incorrect file, hiding the real cause of the problems.
-rwxr-xr-xMakefile.SH2
-rw-r--r--vms/descrip_mms.template2
2 files changed, 2 insertions, 2 deletions
diff --git a/Makefile.SH b/Makefile.SH
index 9ef70bd5aa..ab0d48b0ed 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -685,7 +685,7 @@ generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
$(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib
- $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(@ARGV)' DynaLoader $(static_ext) > perlmain.c
+ $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext)
# The file ext.libs is a list of libraries that must be linked in
# for static extensions, e.g. -lm -lgdbm, etc. The individual
diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index 523daf6e23..0415b955d2 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -365,7 +365,7 @@ $(DBG)libperlmini$(OLB) : $(mini_obj)
Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
perlmain.c : miniperlmain.c $(MINIPERL_EXE) nonxsext
- $(MINIPERL) -"MExtUtils::Miniperl" -e "writemain(@ARGV)" "$(EXT)" > perlmain.c
+ $(MINIPERL) -"MExtUtils::Miniperl" -e "writemain(\'perlmain.c', @ARGV)" "$(EXT)"
.ifdef __DEBUG__
# Link an extra perl that doesn't invoke the debugger