version 1.154, 2020/01/13 15:24:31 |
version 1.155, 2020/01/13 15:41:53 |
|
|
* |
* |
* Job_Init Called to initialize this module. |
* Job_Init Called to initialize this module. |
* |
* |
* Job_Begin execute commands attached to the .BEGIN target |
|
* if any. |
|
* |
|
* can_start_job Return true if we can start job |
* can_start_job Return true if we can start job |
* |
* |
* Job_Empty Return true if the job table is completely |
* Job_Empty Return true if the job table is completely |
* empty. |
* empty. |
* |
* |
* Job_Finish Perform any final processing which needs doing. |
|
* This includes the execution of any commands |
|
* which have been/were attached to the .END |
|
* target. |
|
* |
|
* Job_AbortAll Abort all current jobs. It doesn't |
* Job_AbortAll Abort all current jobs. It doesn't |
* handle output or do anything for the jobs, |
* handle output or do anything for the jobs, |
* just kills them. |
* just kills them. |
|
|
#include "lst.h" |
#include "lst.h" |
#include "gnode.h" |
#include "gnode.h" |
#include "memory.h" |
#include "memory.h" |
#include "make.h" |
|
#include "buf.h" |
#include "buf.h" |
|
#include "enginechoice.h" |
|
|
static int aborting = 0; /* why is the make aborting? */ |
static int aborting = 0; /* why is the make aborting? */ |
#define ABORT_ERROR 1 /* Because of an error */ |
#define ABORT_ERROR 1 /* Because of an error */ |
|
|
static Job *heldJobs; /* Jobs not running yet because of expensive */ |
static Job *heldJobs; /* Jobs not running yet because of expensive */ |
static pid_t mypid; /* Used for printing debugging messages */ |
static pid_t mypid; /* Used for printing debugging messages */ |
static Job *extra_job; /* Needed for .INTERRUPT */ |
static Job *extra_job; /* Needed for .INTERRUPT */ |
static bool compatMode; /* If we're running with compat.c don't call Make_Update */ |
|
|
|
static volatile sig_atomic_t got_fatal; |
static volatile sig_atomic_t got_fatal; |
|
|
|
|
* non-zero status that we shouldn't ignore, we call |
* non-zero status that we shouldn't ignore, we call |
* Make_Update to update the parents. */ |
* Make_Update to update the parents. */ |
job->node->built_status = REBUILT; |
job->node->built_status = REBUILT; |
if (!compatMode) |
engine_node_updated(job->node); |
Make_Update(job->node); |
|
} |
} |
if (job->flags & JOB_KEEPERROR) { |
if (job->flags & JOB_KEEPERROR) { |
job->next = errorJobs; |
job->next = errorJobs; |
|
|
} |
} |
|
|
void |
void |
Job_Init(int maxJobs, bool compat) |
Job_Init(int maxJobs) |
{ |
{ |
Job *j; |
Job *j; |
int i; |
int i; |
|
|
errorJobs = NULL; |
errorJobs = NULL; |
availableJobs = NULL; |
availableJobs = NULL; |
sequential = maxJobs == 1; |
sequential = maxJobs == 1; |
compatMode = compat; |
|
|
|
/* we allocate n+1 jobs, since we may need an extra job for |
/* we allocate n+1 jobs, since we may need an extra job for |
* running .INTERRUPT. */ |
* running .INTERRUPT. */ |
|
|
/*NOTREACHED*/ |
/*NOTREACHED*/ |
fprintf(stderr, "This should never happen\n"); |
fprintf(stderr, "This should never happen\n"); |
exit(1); |
exit(1); |
} |
|
|
|
/* |
|
*----------------------------------------------------------------------- |
|
* Job_Finish -- |
|
* Do final processing such as the running of the commands |
|
* attached to the .END target. |
|
* |
|
* return true if fatal errors have happened. |
|
*----------------------------------------------------------------------- |
|
*/ |
|
bool |
|
Job_Finish(void) |
|
{ |
|
bool problem = errorJobs != NULL; |
|
|
|
if ((end_node->type & OP_DUMMY) == 0) { |
|
if (problem) { |
|
Error("Errors reported so .END ignored"); |
|
} else { |
|
Job_Make(end_node); |
|
loop_handle_running_jobs(); |
|
} |
|
} |
|
return problem; |
|
} |
|
|
|
void |
|
Job_Begin(void) |
|
{ |
|
if ((begin_node->type & OP_DUMMY) == 0) { |
|
Job_Make(begin_node); |
|
loop_handle_running_jobs(); |
|
} |
|
} |
} |
|
|
/*- |
/*- |