| 291 | */ |
| 292 | |
| 293 | static void make1a( state * const pState ) |
| 294 | { |
| 295 | TARGET * t = pState->t; |
| 296 | TARGET * const scc_root = target_scc( t ); |
| 297 | |
| 298 | if ( !pState->parent || target_scc( pState->parent ) != scc_root ) |
| 299 | pState->t = t = scc_root; |
| 300 | |
| 301 | /* If the parent is the first to try to build this target or this target is |
| 302 | * in the MAKE1C quagmire, arrange for the parent to be notified when this |
| 303 | * target has been built. |
| 304 | */ |
| 305 | if ( pState->parent && t->progress <= T_MAKE_RUNNING ) |
| 306 | { |
| 307 | TARGET * const parent_scc = target_scc( pState->parent ); |
| 308 | if ( t != parent_scc ) |
| 309 | { |
| 310 | t->parents = targetentry( t->parents, parent_scc ); |
| 311 | ++parent_scc->asynccnt; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | /* If the target has been previously updated with -n in effect, and we are |
| 316 | * now ignoring -n, update it for real. E.g. if the UPDATE_NOW rule was |
| 317 | * called for it twice - first with the -n option and then without. |
| 318 | */ |
| 319 | if ( !globs.noexec && t->progress == T_MAKE_NOEXEC_DONE ) |
| 320 | t->progress = T_MAKE_INIT; |
| 321 | |
| 322 | /* If this target is already being processed then do nothing. There is no |
| 323 | * need to start processing the same target all over again. |
| 324 | */ |
| 325 | if ( t->progress != T_MAKE_INIT ) |
| 326 | { |
| 327 | pop_state( &state_stack ); |
| 328 | return; |
| 329 | } |
| 330 | |
| 331 | /* Guard against circular dependencies. */ |
| 332 | t->progress = T_MAKE_ONSTACK; |
| 333 | |
| 334 | /* 'asynccnt' counts the dependencies preventing this target from proceeding |
| 335 | * to MAKE1C for actual building. We start off with a count of 1 to prevent |
| 336 | * anything from happening until we can notify all dependencies that they |
| 337 | * are needed. This 1 is then accounted for when we enter MAKE1B ourselves, |
| 338 | * below. Without this if a dependency gets built before we finish |
| 339 | * processing all of our other dependencies our build might be triggerred |
| 340 | * prematurely. |
| 341 | */ |
| 342 | t->asynccnt = 1; |
| 343 | |
| 344 | /* Push dependency build requests (to be executed in the natural order). */ |
| 345 | { |
| 346 | stack temp_stack = { NULL }; |
| 347 | TARGETS * c; |
| 348 | for ( c = t->depends; c && !quit; c = c->next ) |
| 349 | push_state( &temp_stack, c->target, t, T_STATE_MAKE1A ); |
| 350 | push_stack_on_stack( &state_stack, &temp_stack ); |
no test coverage detected