⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make1.c

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 C
📖 第 1 页 / 共 3 页
字号:
        {            failed = c->target;            pState->t->status = c->target->status;        }    /* If a internal header node failed to build, we'd want to output the        target that it failed on. */    if (failed && (failed->flags & T_FLAG_INTERNAL)) {        failed_name = failed->failed;    } else if (failed) {        failed_name = failed->name;    }    t->failed = failed_name;    /* If actions on deps have failed, bail. */    /* Otherwise, execute all actions to make target */    if( pState->t->status == EXEC_CMD_FAIL && pState->t->actions )    {        ++counts->skipped;        if ( ( pState->t->flags & ( T_FLAG_RMOLD | T_FLAG_NOTFILE ) ) == T_FLAG_RMOLD )        {            if( !unlink( pState->t->boundname ) )                printf( "...removing outdated %s\n", pState->t->boundname );        }        else {            printf( "...skipped %s for lack of %s...\n", pState->t->name, failed_name );        }    }    if( pState->t->status == EXEC_CMD_OK )        switch( pState->t->fate )        {            /* These are handled by the default case below now        case T_FATE_INIT:        case T_FATE_MAKING:            */        case T_FATE_STABLE:        case T_FATE_NEWER:            break;        case T_FATE_CANTFIND:        case T_FATE_CANTMAKE:            pState->t->status = EXEC_CMD_FAIL;            break;        case T_FATE_ISTMP:            if( DEBUG_MAKE )                printf( "...using %s...\n", pState->t->name );            break;        case T_FATE_TOUCHED:        case T_FATE_MISSING:        case T_FATE_NEEDTMP:        case T_FATE_OUTDATED:        case T_FATE_UPDATE:        case T_FATE_REBUILD:            /* Set "on target" vars, build actions, unset vars */            /* Set "progress" so that make1c() counts this target among */            /* the successes/failures. */            if( pState->t->actions )            {                ++counts->total;                if( DEBUG_MAKE && !( counts->total % 100 ) )                    printf( "...on %dth target...\n", counts->total );                pState->t->cmds = (char *)make1cmds( pState->t );                pState->t->progress = T_MAKE_RUNNING;            }            break;                        /* All possible fates should have been accounted for by now */        default:            printf("ERROR: %s has bad fate %d", pState->t->name, pState->t->fate);            abort();        }		/* Call make1c() to begin the execution of the chain of commands */		/* needed to build target.  If we're not going to build target */		/* (because of dependency failures or because no commands need to */		/* be run) the chain will be empty and make1c() will directly */		/* signal the completion of target. */	/* Recurse on our dependents, manipulating progress to guard */#ifdef OPT_SEMAPHORE	/* If there is a semaphore, indicate that its in use */	if( pState->t->semaphore )	{	    ++(pState->t->semaphore->asynccnt);	    if( DEBUG_EXECCMD )		printf( "SEM: %s now used by %s\n", pState->t->semaphore->name,		       pState->t->name );	}#endif	pState->curstate = T_STATE_MAKE1C;}/* * make1c() - launch target's next command, call make1b() when done */static voidmake1c( state *pState ){	CMD	*cmd = (CMD *)pState->t->cmds;	/* If there are (more) commands to run to build this target */	/* (and we haven't hit an error running earlier comands) we */	/* launch the command with execcmd(). */		/* If there are no more commands to run, we collect the status */	/* from all the actions then report our completion to all the */	/* parents. */	if( cmd && pState->t->status == EXEC_CMD_OK )	{            char *rule_name = 0;            char *target = 0;		if( DEBUG_MAKEQ ||             ! ( cmd->rule->actions->flags & RULE_QUIETLY ) && DEBUG_MAKE)	    {            rule_name = cmd->rule->name;            target = lol_get(&cmd->args, 0)->string;            if ( globs.noexec )            {                out_action(rule_name,target,cmd->buf,"","",EXIT_OK);            }	    }	    if( globs.noexec )	    {			pState->curstate = T_STATE_MAKE1D;			pState->status = EXEC_CMD_OK;	    } 	    else	    {			TARGET *t = pState->t;			pop_state(&state_stack); /* pop state first because execcmd could push state */			execcmd( cmd->buf, make_closure, t, cmd->shell, rule_name, target );	    }	}	else	{	    TARGETS	*c;	    ACTIONS	*actions;	    /* Collect status from actions, and distribute it as well */	    for( actions = pState->t->actions; actions; actions = actions->next )		if( actions->action->status > pState->t->status )		    pState->t->status = actions->action->status;	    for( actions = pState->t->actions; actions; actions = actions->next )		if( pState->t->status > actions->action->status )		    actions->action->status = pState->t->status;	    /* Tally success/failure for those we tried to update. */	    if( pState->t->progress == T_MAKE_RUNNING )		switch( pState->t->status )	    {	    case EXEC_CMD_OK:		++counts->made;		break;	    case EXEC_CMD_FAIL:		++counts->failed;		break;	    }	    /* Tell parents dependent has been built */		{			stack temp_stack = { NULL };			TARGET *t = pState->t;                        TARGET* additional_includes = NULL;			t->progress = T_MAKE_DONE;            /* Target was updated. Rescan dependencies. */            if (t->fate >= T_FATE_MISSING &&                t->status == EXEC_CMD_OK &&                !t->rescanned) {                TARGET *target_to_rescan = t;                SETTINGS *s;                               target_to_rescan->rescanned = 1;                if (target_to_rescan->flags & T_FLAG_INTERNAL) {                    target_to_rescan = t->original_target;                                    }                /* Clean current includes */                if (target_to_rescan->includes) {                    target_to_rescan->includes = 0;                }                s = copysettings( target_to_rescan->settings );                pushsettings( s );                headers(target_to_rescan);                popsettings( s );                freesettings( s );                if (target_to_rescan->includes) {                    target_to_rescan->includes->rescanned = 1;                    /* Tricky. The parents were already processed, but they                       did not seen the internal node, because it was just                        created. We need to make the calls to make1a that would                       have been done by parents here, and also make sure all                       unprocessed parents will pick up the includes. We must                       make sure processing of the additional make1a invocations                       is done before make1b which means this target is built,                       otherwise the parent will be considered built before this                       make1a processing is even started.                    */                    make0(target_to_rescan->includes, target_to_rescan->parents->target, 0, 0, 0);                    for( c = target_to_rescan->parents; c; c = c->next) {                        c->target->depends = targetentry( c->target->depends,                                                           target_to_rescan->includes );                    }                    /* Will be processed below. */                    additional_includes = target_to_rescan->includes;                }                            }            if (additional_includes)                for ( c = t->parents; c; c = c->next ) {                                                push_state(&temp_stack, additional_includes, c->target, T_STATE_MAKE1A);                                    }			for( c = t->parents; c; c = c->next ) {				push_state(&temp_stack, c->target, NULL, T_STATE_MAKE1B);            }             #ifdef OPT_SEMAPHORE	    /* If there is a semaphore, its now free */	    if( t->semaphore )	    {		assert( t->semaphore->asynccnt == 1 );		--(t->semaphore->asynccnt);		if( DEBUG_EXECCMD )		    printf( "SEM: %s is now free\n", t->semaphore->name);		/* If anything is waiting, notify the next target. There's no            point in notifying all waiting targets, since they'll be            serialized again. */		if( t->semaphore->parents )		{		    TARGETS *first = t->semaphore->parents;		    if( first->next )			first->next->tail = first->tail;		    t->semaphore->parents = first->next;		    if( DEBUG_EXECCMD )			printf( "SEM: placing %s on stack\n", first->target->name);            push_state(&temp_stack, first->target, NULL, T_STATE_MAKE1B);		    BJAM_FREE( first );		}	    }#endif					/* must pop state before pushing any more */			pop_state(&state_stack);					/* using stacks reverses the order of execution. Reverse it back */			push_stack_on_stack(&state_stack, &temp_stack);		}	}}/* Look up the __TIMING_RULE__ variable on the given target, and if * non-empty, invoke the rule it names, passing the given * timing_info */static void call_timing_rule(TARGET* target, timing_info* time){    LIST* timing_rule;        pushsettings(target->settings);    timing_rule = var_get( "__TIMING_RULE__" );    popsettings(target->settings);    if (timing_rule)    {        /* rule timing-rule (            args * :            target :            start end user system ) */        /* Prepare the argument list */        FRAME frame[1];        frame_init( frame );        /* args * :: $(__ACTION_RULE__[2-]) */        lol_add( frame->args, list_copy( L0, timing_rule->next ) );        /* target :: the name of the target */        lol_add( frame->args, list_new( L0, target->name ) );        /* start end user system :: info about the action command */        lol_add( frame->args,            list_new( list_new( list_new( list_new( L0,                outf_time(time->start) ),                outf_time(time->end) ),                outf_double(time->user) ),                outf_double(time->system) ) );        /* Call the rule. */        evaluate_rule( timing_rule->string, frame );        /* Clean up */        frame_free( frame );    }}/* Look up the __ACTION_RULE__ variable on the given target, and if * non-empty, invoke the rule it names, passing the given info,  * timing_info, executed command and command output */static void call_action_rule(TARGET* target, int status, timing_info* time,    char *executed_command, char *command_output){    LIST* action_rule;    pushsettings(target->settings);    action_rule = var_get( "__ACTION_RULE__" );    popsettings(target->settings);    if (action_rule)    {        /* rule action-rule (            args * :            target :            command status start end user system :            output ? ) */        /* Prepare the argument list */        FRAME frame[1];        frame_init( frame );        /* args * :: $(__ACTION_RULE__[2-]) */        lol_add( frame->args, list_copy( L0, action_rule->next ) );        /* target :: the name of the target */        lol_add( frame->args, list_new( L0, target->name ) );        /* command status start end user system :: info about the action command */        lol_add( frame->args,            list_new( list_new( list_new( list_new( list_new( list_new( L0,                newstr(executed_command) ),                outf_int(status) ),                outf_time(time->start) ),                outf_time(time->end) ),                outf_double(time->user) ),                outf_double(time->system) ) );        /* output ? :: the output of the action command */        if (command_output)            lol_add(frame->args, list_new(L0, newstr(command_output)));        else            lol_add(frame->args, L0);        /* Call the rule. */        evaluate_rule( action_rule->string, frame );        /* Clean up */        frame_free( frame );    }}static void make_closure(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -