/*- *----------------------------------------------------------------------- * CondDoTargetWithCommands -- * See if the given node exists and has commands. * * Results: * true if the node is complete and false if it does not. *----------------------------------------------------------------------- */ static bool CondDoTargetWithCommands(struct Name *arg) { GNode *gn; gn = Targ_FindNodei(arg->s, arg->e, TARG_NOCREATE); if (gn != NULL && !OP_NOP(gn->type) && (gn->type & OP_HAS_COMMANDS)) return true; else return false; }
/*- *----------------------------------------------------------------------- * CondDoTarget -- * See if the given node exists and is an actual target. * * Results: * true if the node exists as a target and false if it does not. *----------------------------------------------------------------------- */ static bool CondDoTarget(struct Name *arg) { GNode *gn; gn = Targ_FindNodei(arg->s, arg->e, TARG_NOCREATE); if (gn != NULL && !OP_NOP(gn->type)) return true; else return false; }
/*- *--------------------------------------------------------------------- * ParseDoSrc -- * Given the name of a source, figure out if it is an attribute * and apply it to the targets if it is. Else decide if there is * some attribute which should be applied *to* the source because * of some special target and apply it if so. Otherwise, make the * source be a child of the targets in the list 'targets' * * Side Effects: * Operator bits may be added to the list of targets or to the source. * The targets may have a new source added to their lists of children. *--------------------------------------------------------------------- */ static void ParseDoSrc( struct growableArray *targets, struct growableArray *sources, int tOp, /* operator (if any) from special targets */ const char *src, /* name of the source to handle */ const char *esrc) { GNode *gn = Targ_FindNodei(src, esrc, TARG_CREATE); if ((gn->special & SPECIAL_SOURCE) != 0) { if (gn->special_op) { Array_FindP(targets, ParseDoOp, gn->special_op); return; } else { assert((gn->special & SPECIAL_MASK) == SPECIAL_WAIT); waiting++; return; } } switch (specType) { case SPECIAL_MAIN: /* * If we have noted the existence of a .MAIN, it means we need * to add the sources of said target to the list of things * to create. Note that this will only be invoked if the user * didn't specify a target on the command line. This is to * allow #ifmake's to succeed, or something... */ Lst_AtEnd(create, gn->name); /* * Add the name to the .TARGETS variable as well, so the user * can employ that, if desired. */ Var_Append(".TARGETS", gn->name); return; case SPECIAL_ORDER: /* * Create proper predecessor/successor links between the * previous source and the current one. */ if (predecessor != NULL) { Lst_AtEnd(&predecessor->successors, gn); Lst_AtEnd(&gn->preds, predecessor); } predecessor = gn; break; default: /* * In the case of a source that was the object of a :: operator, * the attribute is applied to all of its instances (as kept in * the 'cohorts' list of the node) or all the cohorts are linked * to all the targets. */ apply_op(targets, tOp, gn); if ((gn->type & OP_OPMASK) == OP_DOUBLEDEP) { LstNode ln; for (ln=Lst_First(&gn->cohorts); ln != NULL; ln = Lst_Adv(ln)){ apply_op(targets, tOp, (GNode *)Lst_Datum(ln)); } } break; } gn->order = waiting; Array_AtEnd(sources, gn); if (waiting) Array_Find(sources, ParseAddDep, gn); }