* Makefile.am (check-regression): Use PERLFLAGS when running Perl

* maintMakefile: Set PERLFLAGS to enable warnings.
* tests/run_make_tests.pl: Clean up issues pointed out by perl -w.
diff --git a/Makefile.am b/Makefile.am
index 30b6ee2..c51f9e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -161,8 +161,8 @@
 		     rm -f tests/$$f; ln -s ../srctests/$$f tests; \
 		   done; fi ;; \
 	    esac; \
-	    echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
-	    cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
+	    echo "cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
+	    cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
 	  else \
 	    echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
 	  fi; \
diff --git a/maintMakefile b/maintMakefile
index 0a44a62..a467ac0 100644
--- a/maintMakefile
+++ b/maintMakefile
@@ -26,6 +26,9 @@
 # Where to put the CVS checkout of the GNU make web repository
 MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
 
+# Enable Perl warnings for the test suite
+PERLFLAGS := -w
+
 # We like mondo-warnings!
 # Also force comments to be preserved.  This helps when using ccache, in
 # combination with GCC 7's implicit-fallthrough warning.
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 16a0e3f..b36de69 100644
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -98,7 +98,7 @@
 $ERR_no_such_file = undef;
 $ERR_read_only_file = undef;
 $ERR_unreadable_file = undef;
-$ERR_noexe_file = undef;
+$ERR_nonexe_file = undef;
 $ERR_exe_dir = undef;
 
 {
@@ -387,7 +387,7 @@
       # If we have a purify log, save it
       $tn = $pure_testname . ($num_of_logfiles ? ".$num_of_logfiles" : "");
       print("Renaming purify log file to $tn\n") if $debug;
-      rename($pure_log, "$tn") or die "Can't rename $log to $tn: $!\n";
+      rename($pure_log, "$tn") or die "Can't rename $pure_log to $tn: $!\n";
       ++$purify_errors;
     } else {
       unlink($pure_log);
@@ -397,7 +397,6 @@
   if ($code != $expected_code) {
     print "Error running @make_command (expected $expected_code; got $code): $cmdstr\n";
     $test_passed = 0;
-    $runf = &get_runfile;
     &create_file (&get_runfile, $command_string);
     # If it's a SIGINT, stop here
     if ($code & 127) {
@@ -542,11 +541,6 @@
     }
   }
 
-  # On DOS/Windows system the filesystem apparently can't track
-  # timestamps with second granularity (!!).  Change the sleep time
-  # needed to force a file to be considered "old".
-  $wtime = $port_type eq 'UNIX' ? 1 : $port_type eq 'OS/2' ? 2 : 4;
-
   # Find the full pathname of Make.  For DOS systems this is more
   # complicated, so we ask make itself.
   if ($osname eq 'VMS') {