$description = "The following test creates a makefile to test the -j option\n"
              ."which tells make to how many jobs to start in parallel.  \n"
              ."Normally, make will execute only one command at a time, \n"
              ."waiting for it to finish before executing the next.  The \n"
              ."-j option tells make to execute many commands simultaneously";


$details = "This test creates a makefile with three double-colon default\n"
          ."rules.  The first rule has a series of sleep and echo commands\n"
          ."intended to run in series.  The second and third have just an \n"
          ."echo statement.  When make is called in this test, it is given\n"
          ."the -j option with a value of 4.  This tells make that it may\n"
          ."start up to four jobs simultaneously.  In this case, since the\n"
          ."first command is a sleep command, the output of the second \n"
          ."and third commands will appear before the first if indeed \n"
          ."make is running all of these commands in parallel.";

if ($vos)
{
   $delete_command = "delete_file -no_ask";
   $sleep_command = "sleep -seconds";
}
else
{
   $delete_command = "rm";
   $sleep_command = "sleep";
}

open(MAKEFILE,"> $makefile");

# The Contents of the MAKEFILE ...

print MAKEFILE "all : def_1 def_5 def_6\n"
              ."def_1 : \n"
              ."\t\@$sleep_command 6 ; echo ONE \n"
              ."\t\@echo TWO \n"
              ."\t\@$sleep_command 3 ; echo THREE \n"
              ."\t\@echo FOUR\n"
	      ."def_5 : \n"
              ."\t\@echo FIVE \n"
              ."def_6 : \n"
              ."\t\@$sleep_command 1 ; echo SIX \n";


# END of Contents of MAKEFILE

close(MAKEFILE);

&run_make_with_options($makefile,"-j 4",&get_logfile);

$answer = "FIVE\n"
         ."SIX\n"
         ."ONE\n"
         ."TWO\n"
         ."THREE\n"
         ."FOUR\n";

&compare_output($answer,&get_logfile(1));

1;
