int run_gnode(GNode *gn) { if (gn != NULL && (gn->type & OP_DUMMY) == 0) { expand_commands(gn); return run_prepared_gnode(gn); } else { return NOSUCHNODE; } }
static Job * prepare_job(GNode *gn, int flags) { bool cmdsOK; /* true if the nodes commands were all right */ bool noExec; /* Set true if we decide not to run the job */ /* * Check the commands now so any attributes from .DEFAULT have a chance * to migrate to the node */ cmdsOK = Job_CheckCommands(gn); expand_commands(gn); if ((gn->type & OP_MAKE) || (!noExecute && !touchFlag)) { /* * We're serious here, but if the commands were bogus, we're * also dead... */ if (!cmdsOK) job_failure(gn, Punt); if (Lst_IsEmpty(&gn->commands)) noExec = true; else noExec = false; } else if (noExecute) { if (!cmdsOK || Lst_IsEmpty(&gn->commands)) noExec = true; else noExec = false; } else { /* * Just touch the target and note that no shell should be * executed. Check * the commands, too, but don't die if they're no good -- it * does no harm to keep working up the graph. */ Job_Touch(gn); noExec = true; } /* * If we're not supposed to execute a shell, don't. */ if (noExec) { /* * We only want to work our way up the graph if we aren't here * because the commands for the job were no good. */ if (cmdsOK && !aborting) { gn->built_status = MADE; Make_Update(gn); } return NULL; } else { Job *job; /* new job descriptor */ job = emalloc(sizeof(Job)); if (job == NULL) Punt("JobStart out of memory"); job->node = gn; /* * Set the initial value of the flags for this job based on the * global ones and the node's attributes... Any flags supplied * by the caller are also added to the field. */ job->flags = flags; if (gn->type & OP_CHEAP) return job; if ((gn->type & OP_EXPENSIVE) || expensive_commands(&gn->expanded)) job->flags |= JOB_IS_EXPENSIVE; return job; } }