chip@ateng.ateng.com (Chip Salzenberg) (10/11/89)
[BUG FIX, INCOMPLETE] This patch is an attempt to make the job_slots feature work as advertised. In particular, the remake.c patch keeps make from exiting immediately with status 1 after spawning the first job. Index: commands.c *************** *** 335,353 **** } - /* First set the automatic variables according to this file. */ - - initialize_file_variables (file); - - set_file_variables (file); - /* Chop the commands up into lines. */ if (cmds->command_lines == 0) chop_commands (cmds); if (job_slots > 0) ! /* Wait for a job slot to be freed up. */ ! while (job_slots_used == job_slots) ! wait_for_children (1, 0); /* Start the command sequence, record it in a new `struct child', and add that to the chain. */ --- 334,355 ---- } /* Chop the commands up into lines. */ + if (cmds->command_lines == 0) chop_commands (cmds); + /* Wait for a job slot to be freed up. */ + if (job_slots > 0) ! { ! while (job_slots_used == job_slots) ! wait_for_children (1, 0); ! } + /* Set the automatic variables according to this file. */ + + initialize_file_variables (file); + set_file_variables (file); + /* Start the command sequence, record it in a new `struct child', and add that to the chain. */ *************** *** 370,383 **** } ! unblock_children (); ! ! if (status) { free (c->commands); free ((char *) c); - file->update_status = (just_print_flag || touch_flag) ? 0 : 1; } ! else if (job_slots == 1) { /* Since there is only one job slot, make things run linearly. --- 372,387 ---- } ! if (status == 0) ! file->update_status = 0; ! else { free (c->commands); free ((char *) c); file->update_status = (just_print_flag || touch_flag) ? 0 : 1; } ! ! unblock_children (); ! ! if (status == 0 && job_slots == 1) { /* Since there is only one job slot, make things run linearly. *************** *** 385,390 **** while (file->command_state != cs_finished) wait_for_children (1, 0); - } notice_finished_file (file); } --- 389,394 ---- while (file->command_state != cs_finished) wait_for_children (1, 0); } + notice_finished_file (file); } Index: remake.c *************** *** 630,633 **** --- 633,638 ---- struct file *file; { + int has_commands = 0; + if (file->cmds == 0 && !(touch_flag && !file->is_target)) { *************** *** 664,672 **** } else ! execute_file_commands (file); } ! file->command_state = cs_finished; ! notice_finished_file (file); } --- 669,683 ---- } else ! { ! execute_file_commands (file); ! has_commands = 1; ! } } ! if (!has_commands) ! { ! file->command_state = cs_finished; ! notice_finished_file (file); ! } }