int make( int n_targets, const char **targets, int anyhow ) { int i; COUNTS counts[1]; int status = 0; /* 1 if anything fails */ #ifdef OPT_HEADER_CACHE_EXT hcache_init(); #endif memset( (char *)counts, 0, sizeof( *counts ) ); /* First bind all targets with LOCATE_TARGET setting. This is needed to correctly handle dependencies to generated headers. */ bind_explicitly_located_targets(); { PROFILE_ENTER(MAKE_MAKE0); for( i = 0; i < n_targets; i++ ) { TARGET *t = bindtarget( targets[i] ); make0( t, 0, 0, counts, anyhow ); } PROFILE_EXIT(MAKE_MAKE0); } #ifdef OPT_GRAPH_DEBUG_EXT if( DEBUG_GRAPH ) { for( i = 0; i < n_targets; i++ ) { TARGET *t = bindtarget( targets[i] ); dependGraphOutput( t, 0 ); } } #endif if( DEBUG_MAKE ) { if( counts->targets ) printf( "...found %d target%s...\n", counts->targets, counts->targets > 1 ? "s" : "" ); if( counts->temp ) printf( "...using %d temp target%s...\n", counts->temp, counts->temp > 1 ? "s" : "" ); if( counts->updating ) printf( "...updating %d target%s...\n", counts->updating, counts->updating > 1 ? "s" : "" ); if( counts->cantfind ) printf( "...can't find %d target%s...\n", counts->cantfind, counts->cantfind > 1 ? "s" : "" ); if( counts->cantmake ) printf( "...can't make %d target%s...\n", counts->cantmake, counts->cantmake > 1 ? "s" : "" ); } #ifdef OPT_HEADER_CACHE_EXT hcache_done(); #endif status = counts->cantfind || counts->cantmake; { PROFILE_ENTER(MAKE_MAKE1); for( i = 0; i < n_targets; i++ ) status |= make1( bindtarget( targets[i] ) ); PROFILE_EXIT(MAKE_MAKE1); } return status; }
static void dependGraphOutput( TARGET *t, int depth ) { TARGETS *c; if ( (t->flags & T_FLAG_VISITED) != 0 || !t->name || !t->boundname) return; t->flags |= T_FLAG_VISITED; switch (t->fate) { case T_FATE_TOUCHED: case T_FATE_MISSING: case T_FATE_OUTDATED: case T_FATE_UPDATE: printf( "->%s%2d Name: %s\n", spaces(depth), depth, target_name(t) ); break; default: printf( " %s%2d Name: %s\n", spaces(depth), depth, target_name(t) ); break; } if( strcmp (t->name, t->boundname) ) { printf( " %s Loc: %s\n", spaces(depth), t->boundname ); } switch( t->fate ) { case T_FATE_STABLE: printf( " %s : Stable\n", spaces(depth) ); break; case T_FATE_NEWER: printf( " %s : Newer\n", spaces(depth) ); break; case T_FATE_ISTMP: printf( " %s : Up to date temp file\n", spaces(depth) ); case T_FATE_NEEDTMP: printf( " %s : Temporary file, to be updated\n", spaces(depth) ); break; case T_FATE_TOUCHED: printf( " %s : Been touched, updating it\n", spaces(depth) ); break; case T_FATE_MISSING: printf( " %s : Missing, creating it\n", spaces(depth) ); break; case T_FATE_OUTDATED: printf( " %s : Outdated, updating it\n", spaces(depth) ); break; case T_FATE_REBUILD: printf( " %s : Rebuild, Updating it\n", spaces(depth) ); break; case T_FATE_UPDATE: printf( " %s : Updating it\n", spaces(depth) ); break; case T_FATE_CANTFIND: printf( " %s : Can't find it\n", spaces(depth) ); break; case T_FATE_CANTMAKE: printf( " %s : Can't make it\n", spaces(depth) ); break; } if( t->flags & ~T_FLAG_VISITED ) { printf( " %s : ", spaces(depth) ); if( t->flags & T_FLAG_TEMP ) printf ("TEMPORARY "); if( t->flags & T_FLAG_NOCARE ) printf ("NOCARE "); if( t->flags & T_FLAG_NOTFILE ) printf ("NOTFILE "); if( t->flags & T_FLAG_TOUCHED ) printf ("TOUCHED "); if( t->flags & T_FLAG_LEAVES ) printf ("LEAVES "); if( t->flags & T_FLAG_NOUPDATE ) printf ("NOUPDATE "); printf( "\n" ); } for( c = t->depends; c; c = c->next ) { printf( " %s : Depends on %s (%s)", spaces(depth), target_name(c->target), target_fate[ c->target->fate ] ); if (c->target->time == t->time) printf( " (max time)"); printf("\n"); } for( c = t->depends; c; c = c->next ) { dependGraphOutput( c->target, depth + 1 ); } }
int make( LIST * targets, int anyhow ) { COUNTS counts[ 1 ]; int status = 0; /* 1 if anything fails */ #ifdef OPT_HEADER_CACHE_EXT hcache_init(); #endif memset( (char *)counts, 0, sizeof( *counts ) ); /* Make sure that the tables are set up correctly. */ exec_init(); /* First bind all targets with LOCATE_TARGET setting. This is needed to * correctly handle dependencies to generated headers. */ bind_explicitly_located_targets(); { LISTITER iter, end; PROFILE_ENTER( MAKE_MAKE0 ); for ( iter = list_begin( targets ), end = list_end( targets ); iter != end; iter = list_next( iter ) ) { TARGET * t = bindtarget( list_item( iter ) ); if ( t->fate == T_FATE_INIT ) make0( t, 0, 0, counts, anyhow, 0 ); } PROFILE_EXIT( MAKE_MAKE0 ); } #ifdef OPT_GRAPH_DEBUG_EXT if ( DEBUG_GRAPH ) { LISTITER iter, end; for ( iter = list_begin( targets ), end = list_end( targets ); iter != end; iter = list_next( iter ) ) dependGraphOutput( bindtarget( list_item( iter ) ), 0 ); } #endif if ( DEBUG_MAKE ) { if ( counts->targets ) out_printf( "...found %d target%s...\n", counts->targets, counts->targets > 1 ? "s" : "" ); if ( counts->temp ) out_printf( "...using %d temp target%s...\n", counts->temp, counts->temp > 1 ? "s" : "" ); if ( counts->updating ) out_printf( "...updating %d target%s...\n", counts->updating, counts->updating > 1 ? "s" : "" ); if ( counts->cantfind ) out_printf( "...can't find %d target%s...\n", counts->cantfind, counts->cantfind > 1 ? "s" : "" ); if ( counts->cantmake ) out_printf( "...can't make %d target%s...\n", counts->cantmake, counts->cantmake > 1 ? "s" : "" ); } status = counts->cantfind || counts->cantmake; { PROFILE_ENTER( MAKE_MAKE1 ); status |= make1( targets ); PROFILE_EXIT( MAKE_MAKE1 ); } return status; }