Blame SOURCES/make-4.2.1-jvar.patch

d5dd1d
From 0c5a9f9b92af1634dc60fa21e9ac86ed50e5d595 Mon Sep 17 00:00:00 2001
d5dd1d
From: Paul Smith <psmith@gnu.org>
d5dd1d
Date: Mon, 30 Oct 2017 12:53:49 -0400
d5dd1d
Subject: * main.c (main): [SV 48274] Allow -j in makefile MAKEFLAGS variable.
d5dd1d
d5dd1d
* tests/jhelp.pl: New file to allow testing parallelism without sleep.
d5dd1d
* tests/scripts/features/parallelism: Test this.
d5dd1d
* tests/scripts/features/jobserver: Update tests.
d5dd1d
* tests/scripts/features/output-sync: Remove useless rm command.
d5dd1d
---
d5dd1d
 main.c                             | 80 ++++++++++++++++++++++++++--------
d5dd1d
 tests/jhelp.pl                     | 63 +++++++++++++++++++++++++++
d5dd1d
 tests/scripts/features/jobserver   |  6 +--
d5dd1d
 tests/scripts/features/output-sync |  2 +-
d5dd1d
 tests/scripts/features/parallelism | 89 +++++++++++++++++++++-----------------
d5dd1d
 5 files changed, 177 insertions(+), 63 deletions(-)
d5dd1d
 create mode 100755 tests/jhelp.pl
d5dd1d
d5dd1d
diff -rupN a/main.c b/main.c
d5dd1d
--- a/main.c	2021-10-18 15:23:21.769274000 -0400
d5dd1d
+++ b/main.c	2021-10-18 15:30:43.579608645 -0400
d5dd1d
@@ -1482,7 +1482,7 @@ main (int argc, char **argv, char **envp
d5dd1d
                                  || output_sync == OUTPUT_SYNC_TARGET);
d5dd1d
   OUTPUT_SET (&make_sync);
d5dd1d
 
d5dd1d
-  /* Remember the job slots set through the environment vs. command line.  */
d5dd1d
+  /* Parse the command line options.  Remember the job slots set this way.  */
d5dd1d
   {
d5dd1d
     int env_slots = arg_job_slots;
d5dd1d
     arg_job_slots = INVALID_JOB_SLOTS;
d5dd1d
@@ -1609,41 +1609,38 @@ main (int argc, char **argv, char **envp
d5dd1d
   /* We may move, but until we do, here we are.  */
d5dd1d
   starting_directory = current_directory;
d5dd1d
 
d5dd1d
-  /* Set up the job_slots value and the jobserver.  This can't be usefully set
d5dd1d
-     in the makefile, and we want to verify the authorization is valid before
d5dd1d
-     make has a chance to start using it for something else.  */
d5dd1d
+  /* Validate the arg_job_slots configuration before we define MAKEFLAGS so
d5dd1d
+     users get an accurate value in their makefiles.
d5dd1d
+     At this point arg_job_slots is the argv setting, if there is one, else
d5dd1d
+     the MAKEFLAGS env setting, if there is one.  */
d5dd1d
 
d5dd1d
   if (jobserver_auth)
d5dd1d
     {
d5dd1d
+      /* We're a child in an existing jobserver group.  */
d5dd1d
       if (argv_slots == INVALID_JOB_SLOTS)
d5dd1d
         {
d5dd1d
+          /* There's no -j option on the command line: check authorization.  */
d5dd1d
           if (jobserver_parse_auth (jobserver_auth))
d5dd1d
             {
d5dd1d
               /* Success!  Use the jobserver.  */
d5dd1d
-              job_slots = 0;
d5dd1d
               goto job_setup_complete;
d5dd1d
             }
d5dd1d
 
d5dd1d
+          /* Oops: we have jobserver-auth but it's invalid :(.  */
d5dd1d
           O (error, NILF, _("warning: jobserver unavailable: using -j1.  Add '+' to parent make rule."));
d5dd1d
           arg_job_slots = 1;
d5dd1d
         }
d5dd1d
 
d5dd1d
-      /* The user provided a -j setting on the command line: use it.  */
d5dd1d
+      /* The user provided a -j setting on the command line so use it: we're
d5dd1d
+         the master make of a new jobserver group.  */
d5dd1d
       else if (!restarts)
d5dd1d
-        /* If restarts is >0 we already printed this message.  */
d5dd1d
-        O (error, NILF,
d5dd1d
-           _("warning: -jN forced in submake: disabling jobserver mode."));
d5dd1d
+        ON (error, NILF,
d5dd1d
+            _("warning: -j%d forced in submake: resetting jobserver mode."),
d5dd1d
+            argv_slots);
d5dd1d
 
d5dd1d
-      /* We failed to use our parent's jobserver.  */
d5dd1d
+      /* We can't use our parent's jobserver, so reset.  */
d5dd1d
       reset_jobserver ();
d5dd1d
-      job_slots = (unsigned int)arg_job_slots;
d5dd1d
     }
d5dd1d
-  else if (arg_job_slots == INVALID_JOB_SLOTS)
d5dd1d
-    /* The default is one job at a time.  */
d5dd1d
-    job_slots = 1;
d5dd1d
-  else
d5dd1d
-    /* Use whatever was provided.  */
d5dd1d
-    job_slots = (unsigned int)arg_job_slots;
d5dd1d
 
d5dd1d
  job_setup_complete:
d5dd1d
 
d5dd1d
@@ -1999,6 +1996,9 @@ main (int argc, char **argv, char **envp
d5dd1d
   {
d5dd1d
     int old_builtin_rules_flag = no_builtin_rules_flag;
d5dd1d
     int old_builtin_variables_flag = no_builtin_variables_flag;
d5dd1d
+    int old_arg_job_slots = arg_job_slots;
d5dd1d
+
d5dd1d
+    arg_job_slots = INVALID_JOB_SLOTS;
d5dd1d
 
d5dd1d
     /* Decode switches again, for variables set by the makefile.  */
d5dd1d
     decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
d5dd1d
@@ -2011,6 +2011,24 @@ main (int argc, char **argv, char **envp
d5dd1d
     decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
d5dd1d
 #endif
d5dd1d
 
d5dd1d
+    /* If -j is not set in the makefile, or it was set on the command line,
d5dd1d
+       reset to use the previous value.  */
d5dd1d
+    if (arg_job_slots == INVALID_JOB_SLOTS || argv_slots != INVALID_JOB_SLOTS)
d5dd1d
+      arg_job_slots = old_arg_job_slots;
d5dd1d
+
d5dd1d
+    else if (jobserver_auth)
d5dd1d
+      {
d5dd1d
+        /* Makefile MAKEFLAGS set -j, but we already have a jobserver.
d5dd1d
+           Make us the master of a new jobserver group.  */
d5dd1d
+        if (!restarts)
d5dd1d
+          ON (error, NILF,
d5dd1d
+              _("warning: -j%d forced in makefile: resetting jobserver mode."),
d5dd1d
+              arg_job_slots);
d5dd1d
+
d5dd1d
+        /* We can't use our parent's jobserver, so reset.  */
d5dd1d
+        reset_jobserver ();
d5dd1d
+      }
d5dd1d
+
d5dd1d
     /* Reset in case the switches changed our mind.  */
d5dd1d
     syncing = (output_sync == OUTPUT_SYNC_LINE
d5dd1d
                || output_sync == OUTPUT_SYNC_TARGET);
d5dd1d
@@ -2037,8 +2055,31 @@ main (int argc, char **argv, char **envp
d5dd1d
       undefine_default_variables ();
d5dd1d
   }
d5dd1d
 
d5dd1d
+  /* Final jobserver configuration.
d5dd1d
+
d5dd1d
+     If we have jobserver_auth then we are a client in an existing jobserver
d5dd1d
+     group, that's already been verified OK above.  If we don't have
d5dd1d
+     jobserver_auth and jobserver is enabled, then start a new jobserver.
d5dd1d
+
d5dd1d
+     arg_job_slots = INVALID_JOB_SLOTS if we don't want -j in MAKEFLAGS
d5dd1d
+
d5dd1d
+     arg_job_slots = # of jobs of parallelism
d5dd1d
+
d5dd1d
+     job_slots = 0 for no limits on jobs, or when limiting via jobserver.
d5dd1d
+
d5dd1d
+     job_slots = 1 for standard non-parallel mode.
d5dd1d
+
d5dd1d
+     job_slots >1 for old-style parallelism without jobservers.  */
d5dd1d
+
d5dd1d
+  if (jobserver_auth)
d5dd1d
+    job_slots = 0;
d5dd1d
+  else if (arg_job_slots == INVALID_JOB_SLOTS)
d5dd1d
+    job_slots = 1;
d5dd1d
+  else
d5dd1d
+    job_slots = arg_job_slots;
d5dd1d
+
d5dd1d
 #if defined (__MSDOS__) || defined (__EMX__) || defined (VMS)
d5dd1d
-  if (arg_job_slots != 1
d5dd1d
+  if (job_slots != 1
d5dd1d
 # ifdef __EMX__
d5dd1d
       && _osmode != OS2_MODE /* turn off -j if we are in DOS mode */
d5dd1d
 # endif
d5dd1d
@@ -2047,7 +2088,8 @@ main (int argc, char **argv, char **envp
d5dd1d
       O (error, NILF,
d5dd1d
          _("Parallel jobs (-j) are not supported on this platform."));
d5dd1d
       O (error, NILF, _("Resetting to single job (-j1) mode."));
d5dd1d
-      arg_job_slots = job_slots = 1;
d5dd1d
+      arg_job_slots = INVALID_JOB_SLOTS;
d5dd1d
+      job_slots = 1;
d5dd1d
     }
d5dd1d
 #endif
d5dd1d
 
d5dd1d
diff -rupN a/tests/jhelp.pl b/tests/jhelp.pl
d5dd1d
--- a/tests/jhelp.pl	1969-12-31 19:00:00.000000000 -0500
d5dd1d
+++ b/tests/jhelp.pl	2021-10-18 15:30:43.582608763 -0400
d5dd1d
@@ -0,0 +1,63 @@
d5dd1d
+#!/usr/bin/env perl
d5dd1d
+# -*-perl-*-
d5dd1d
+#
d5dd1d
+# This script helps us test jobserver/parallelism without a lot of unreliable
d5dd1d
+# (and slow) sleep calls.  Written in Perl to get portable sub-second sleep.
d5dd1d
+#
d5dd1d
+# It can run the following steps based on arguments:
d5dd1d
+#  -t <secs>  : maximum # of seconds the script can run; else we fail.
d5dd1d
+#               Default is 4 seconds.
d5dd1d
+#  -e <word>  : echo <word> to stdout
d5dd1d
+#  -f <word>  : echo <word> to stdout AND create an (empty) file named <word>
d5dd1d
+#  -w <word>  : wait for a file named <word> to exist
d5dd1d
+
d5dd1d
+# Force flush
d5dd1d
+$| = 1;
d5dd1d
+
d5dd1d
+my $timeout = 4;
d5dd1d
+
d5dd1d
+sub op {
d5dd1d
+    my ($op, $nm) = @_;
d5dd1d
+
d5dd1d
+    defined $nm or die "Missing value for $op\n";
d5dd1d
+
d5dd1d
+    if ($op eq '-e') {
d5dd1d
+        print "$nm\n";
d5dd1d
+        return 1;
d5dd1d
+    }
d5dd1d
+
d5dd1d
+    if ($op eq '-f') {
d5dd1d
+        print "$nm\n";
d5dd1d
+        open(my $fh, '>', $nm) or die "$nm: open: $!\n";
d5dd1d
+        close(my $fh);
d5dd1d
+        return 1;
d5dd1d
+    }
d5dd1d
+
d5dd1d
+    if ($op eq '-w') {
d5dd1d
+        if (-f $nm) {
d5dd1d
+            return 1;
d5dd1d
+        }
d5dd1d
+        select(undef, undef, undef, 0.1);
d5dd1d
+        return 0;
d5dd1d
+    }
d5dd1d
+
d5dd1d
+    if ($op eq '-t') {
d5dd1d
+        $timeout = $nm;
d5dd1d
+        return 1;
d5dd1d
+    }
d5dd1d
+
d5dd1d
+    die("Invalid command: $op $nm\n");
d5dd1d
+}
d5dd1d
+
d5dd1d
+my $start = time();
d5dd1d
+while (@ARGV) {
d5dd1d
+    if (op($ARGV[0], $ARGV[1])) {
d5dd1d
+        shift;
d5dd1d
+        shift;
d5dd1d
+    }
d5dd1d
+    if ($start + $timeout < time()) {
d5dd1d
+        die("Timeout after ".(time()-$start-1)." seconds\n");
d5dd1d
+    }
d5dd1d
+}
d5dd1d
+
d5dd1d
+exit(0);
d5dd1d
diff -rupN a/tests/scripts/features/jobserver b/tests/scripts/features/jobserver
d5dd1d
--- a/tests/scripts/features/jobserver	2016-04-09 19:07:29.000000000 -0400
d5dd1d
+++ b/tests/scripts/features/jobserver	2021-10-18 15:30:43.585608880 -0400
d5dd1d
@@ -42,7 +42,7 @@ recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE
d5dd1d
 recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
d5dd1d
 all:;@echo $@: "/$(SHOW)/"
d5dd1d
 !,
d5dd1d
-              "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nrecurse2: /-j3 --jobserver-auth=<auth> $np/\nall: /-j3 --jobserver-auth=<auth> $np/\n");
d5dd1d
+              "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -j3 forced in submake: resetting jobserver mode.\nrecurse2: /-j3 --jobserver-auth=<auth> $np/\nall: /-j3 --jobserver-auth=<auth> $np/\n");
d5dd1d
 delete $extraENV{MAKEFLAGS};
d5dd1d
 
d5dd1d
 # Test override of -jN with -j
d5dd1d
@@ -52,7 +52,7 @@ recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE
d5dd1d
 recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
d5dd1d
 all:;@echo $@: "/$(SHOW)/"
d5dd1d
 !,
d5dd1d
-              "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nrecurse2: /-j $np/\nall: /-j $np/\n");
d5dd1d
+              "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -j0 forced in submake: resetting jobserver mode.\nrecurse2: /-j $np/\nall: /-j $np/\n");
d5dd1d
 
d5dd1d
 # Don't put --jobserver-auth into a re-exec'd MAKEFLAGS.
d5dd1d
 # We can't test this directly because there's no way a makefile can
d5dd1d
@@ -76,7 +76,7 @@ inc.mk:
d5dd1d
 #	@echo 'MAKEFLAGS = $(MAKEFLAGS)'
d5dd1d
 	@echo 'FOO = bar' > $@
d5dd1d
 !,
d5dd1d
-              "$np -j2", "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n");
d5dd1d
+              "$np -j2", "#MAKE#[1]: warning: -j2 forced in submake: resetting jobserver mode.\nall\n");
d5dd1d
 
d5dd1d
 unlink('inc.mk');
d5dd1d
 
d5dd1d
diff -rupN a/tests/scripts/features/output-sync b/tests/scripts/features/output-sync
d5dd1d
--- a/tests/scripts/features/output-sync	2016-04-23 10:09:35.000000000 -0400
d5dd1d
+++ b/tests/scripts/features/output-sync	2021-10-18 15:31:40.903857757 -0400
d5dd1d
@@ -45,7 +45,7 @@ sub output_sync_clean {
d5dd1d
 # reliable.  If things are too fast, then sometimes a different job will steal
d5dd1d
 # the output sync lock and the output is mis-ordered from what we expect.
d5dd1d
 sub output_sync_wait {
d5dd1d
-    return "while [ ! -f ../mksync.$_[0] ]; do :; done; rm -f ../mksync.$_[0].wait; $sleep_command 1";
d5dd1d
+    return "while [ ! -f ../mksync.$_[0] ]; do :; done; $sleep_command 1";
d5dd1d
 }
d5dd1d
 sub output_sync_set {
d5dd1d
     return "date > ../mksync.$_[0]";
d5dd1d
diff -rupN a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
d5dd1d
--- a/tests/scripts/features/parallelism	2016-04-11 07:50:44.000000000 -0400
d5dd1d
+++ b/tests/scripts/features/parallelism	2021-10-18 17:12:39.005009030 -0400
d5dd1d
@@ -1,17 +1,7 @@
d5dd1d
 #                                                                    -*-perl-*-
d5dd1d
 
d5dd1d
 $description = "Test parallelism (-j) option.";
d5dd1d
-
d5dd1d
-
d5dd1d
-$details = "This test creates a makefile with two double-colon default
d5dd1d
-rules.  The first rule has a series of sleep and echo commands
d5dd1d
-intended to run in series.  The second and third have just an
d5dd1d
-echo statement.  When make is called in this test, it is given
d5dd1d
-the -j option with a value of 4.  This tells make that it may
d5dd1d
-start up to four jobs simultaneously.  In this case, since the
d5dd1d
-first command is a sleep command, the output of the second
d5dd1d
-and third commands will appear before the first if indeed
d5dd1d
-make is running all of these commands in parallel.";
d5dd1d
+$details = "";
d5dd1d
 
d5dd1d
 if (!$parallel_jobs) {
d5dd1d
   return -1;
d5dd1d
@@ -24,13 +14,36 @@ else {
d5dd1d
   $sleep_command = "sleep";
d5dd1d
 }
d5dd1d
 
d5dd1d
+rmfiles(qw(ONE TWO THREE FOUR));
d5dd1d
 
d5dd1d
 run_make_test("
d5dd1d
 all : def_1 def_2 def_3
d5dd1d
-def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO
d5dd1d
-def_2 : ; \@$sleep_command 2 ; echo THREE
d5dd1d
-def_3 : ; \@$sleep_command 1 ; echo FOUR",
d5dd1d
+def_1 : ; \@#PERL# jhelp.pl -f ONE -w THREE -e TWO
d5dd1d
+def_2 : ; \@#PERL# jhelp.pl -w FOUR -f THREE
d5dd1d
+def_3 : ; \@#PERL# jhelp.pl -w ONE -f FOUR",
d5dd1d
               '-j4', "ONE\nFOUR\nTHREE\nTWO");
d5dd1d
+rmfiles(qw(ONE TWO THREE FOUR));
d5dd1d
+
d5dd1d
+# Verify -j added to MAKEFLAGS in the makefile
d5dd1d
+run_make_test("
d5dd1d
+MAKEFLAGS += -j4
d5dd1d
+all : def_1 def_2 def_3
d5dd1d
+def_1 : ; \@#PERL# jhelp.pl -f ONE -w THREE -e TWO
d5dd1d
+def_2 : ; \@#PERL# jhelp.pl -w FOUR -f THREE
d5dd1d
+def_3 : ; \@#PERL# jhelp.pl -w ONE -f FOUR",
d5dd1d
+              '', "ONE\nFOUR\nTHREE\nTWO");
d5dd1d
+rmfiles(qw(ONE TWO THREE FOUR));
d5dd1d
+
d5dd1d
+# Command line should take precedence
d5dd1d
+rmfiles(qw(ONE TWO THREE FOUR));
d5dd1d
+run_make_test("
d5dd1d
+MAKEFLAGS += -j2
d5dd1d
+all : def_1 def_2 def_3
d5dd1d
+def_1 : ; \@#PERL# jhelp.pl -f ONE -w THREE -e TWO
d5dd1d
+def_2 : ; \@#PERL# jhelp.pl -w FOUR -f THREE
d5dd1d
+def_3 : ; \@#PERL# jhelp.pl -w ONE -f FOUR",
d5dd1d
+              '-j4', "ONE\nFOUR\nTHREE\nTWO");
d5dd1d
+rmfiles(qw(ONE TWO THREE FOUR));
d5dd1d
 
d5dd1d
 # Test parallelism with included files.  Here we sleep/echo while
d5dd1d
 # building the included files, to test that they are being built in
d5dd1d
@@ -38,12 +51,12 @@ def_3 : ; \@$sleep_command 1 ; echo FOUR
d5dd1d
 run_make_test("
d5dd1d
 all: 1 2; \@echo success
d5dd1d
 -include 1.inc 2.inc
d5dd1d
-1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
d5dd1d
-2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
d5dd1d
+1.inc: ; \@#PERL# jhelp.pl -f ONE.inc -w THREE.inc -f TWO.inc; echo '1: ; \@#PERL# jhelp.pl -f ONE -w THREE -f TWO' > \$\@
d5dd1d
+2.inc: ; \@#PERL# jhelp.pl -w ONE.inc -f THREE.inc; echo '2: ; \@#PERL# jhelp.pl -w ONE -f THREE' > \$\@",
d5dd1d
               "-j4",
d5dd1d
               "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7);
d5dd1d
 
d5dd1d
-rmfiles(qw(1.inc 2.inc));
d5dd1d
+rmfiles(qw(ONE.inc TWO.inc THREE.inc ONE TWO THREE 1.inc 2.inc));
d5dd1d
 
d5dd1d
 
d5dd1d
 # Test parallelism with included files--this time recurse first and make
d5dd1d
@@ -57,12 +70,12 @@ ifeq (\$(INC),yes)
d5dd1d
 -include 1.inc 2.inc
d5dd1d
 endif
d5dd1d
 
d5dd1d
-1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
d5dd1d
-2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
d5dd1d
+1.inc: ; \@#PERL# jhelp.pl -f ONE.inc -w THREE.inc -f TWO.inc; echo '1: ; \@#PERL# jhelp.pl -f ONE -w THREE -f TWO' > \$\@
d5dd1d
+2.inc: ; \@#PERL# jhelp.pl -w ONE.inc -f THREE.inc; echo '2: ; \@#PERL# jhelp.pl -w ONE -f THREE' > \$\@",
d5dd1d
               "-j4",
d5dd1d
               "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7);
d5dd1d
 
d5dd1d
-rmfiles(qw(1.inc 2.inc));
d5dd1d
+rmfiles(qw(ONE.inc TWO.inc THREE.inc ONE TWO THREE 1.inc 2.inc));
d5dd1d
 
d5dd1d
 # Grant Taylor reports a problem where tokens can be lost (not written back
d5dd1d
 # to the pipe when they should be): this happened when there is a $(shell ...)
d5dd1d
@@ -90,21 +103,23 @@ run_make_test("
d5dd1d
 .PHONY: all fail.1 fail.2 fail.3 ok
d5dd1d
 all: fail.1 ok fail.2 fail.3
d5dd1d
 
d5dd1d
+.RECIPEPREFIX := >
d5dd1d
+
d5dd1d
 fail.1 fail.2 fail.3:
d5dd1d
-	\@$sleep_command \$(patsubst fail.%,%,\$\@)
d5dd1d
-	\@echo Fail
d5dd1d
-	\@exit 1
d5dd1d
+> \@$sleep_command \$(patsubst fail.%,%,\$\@)
d5dd1d
+> \@echo Fail
d5dd1d
+> \@exit 1
d5dd1d
 
d5dd1d
 ok:
d5dd1d
-	\@$sleep_command 4
d5dd1d
-	\@echo Ok done",
d5dd1d
+> \@$sleep_command 4
d5dd1d
+> \@echo Ok done",
d5dd1d
               '-rR -j5', "Fail
d5dd1d
-#MAKE#: *** [#MAKEFILE#:8: fail.1] Error 1
d5dd1d
+#MAKE#: *** [#MAKEFILE#:10: fail.1] Error 1
d5dd1d
 #MAKE#: *** Waiting for unfinished jobs....
d5dd1d
 Fail
d5dd1d
-#MAKE#: *** [#MAKEFILE#:8: fail.2] Error 1
d5dd1d
+#MAKE#: *** [#MAKEFILE#:10: fail.2] Error 1
d5dd1d
 Fail
d5dd1d
-#MAKE#: *** [#MAKEFILE#:8: fail.3] Error 1
d5dd1d
+#MAKE#: *** [#MAKEFILE#:10: fail.3] Error 1
d5dd1d
 Ok done",
d5dd1d
              512);
d5dd1d
 
d5dd1d
@@ -117,13 +132,11 @@ all:; @:
d5dd1d
 
d5dd1d
 -include foo.d
d5dd1d
 
d5dd1d
-foo.d: comp
d5dd1d
-	@echo building $@
d5dd1d
+foo.d: comp ; @echo building $@
d5dd1d
 
d5dd1d
 comp: mod_a.o mod_b.o; @:
d5dd1d
 
d5dd1d
-mod_a.o mod_b.o:
d5dd1d
-	@exit 1
d5dd1d
+mod_a.o mod_b.o: ; @exit 1
d5dd1d
 ', '-j2', '');
d5dd1d
 
d5dd1d
 
d5dd1d
@@ -148,15 +161,15 @@ $extraENV{MAKEFLAGS} = '-j4';
d5dd1d
 run_make_test(q!
d5dd1d
 things = thing1 thing2
d5dd1d
 all: $(things)
d5dd1d
-thing1:; @sleep 1; echo '$@ start'; sleep 2; echo '$@ end'
d5dd1d
-thing2:; @echo '$@ start'; sleep 2; echo '$@ end'
d5dd1d
+thing1:; @#PERL# jhelp.pl -w thing2start -f $@start -w thing2end -e $@end
d5dd1d
+thing2:; @#PERL# jhelp.pl -f $@start -w thing1start -f $@end
d5dd1d
 -include inc.mk
d5dd1d
 inc.mk: ; @touch $@
d5dd1d
 !,
d5dd1d
-              '', "thing2 start\nthing1 start\nthing2 end\nthing1 end\n");
d5dd1d
+              '', "thing2start\nthing1start\nthing2end\nthing1end\n");
d5dd1d
 
d5dd1d
 delete $extraENV{MAKEFLAGS};
d5dd1d
-rmfiles('inc.mk');
d5dd1d
+rmfiles(qw(inc.mk thing1start thing1end thing2start thing2end));
d5dd1d
 
d5dd1d
 # Ensure intermediate/secondary files are not pruned incorrectly.
d5dd1d
 # See Savannah bug #30653
d5dd1d
@@ -211,7 +224,3 @@ rmfiles('file1', 'file2', 'file3', 'file
d5dd1d
 # rmfiles(qw(dependfile output));
d5dd1d
 
d5dd1d
 1;
d5dd1d
-
d5dd1d
-### Local Variables:
d5dd1d
-### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
d5dd1d
-### End: