diff --git a/historic/jam/src/builtins.c b/historic/jam/src/builtins.c index 66d178af7..4f94edc3a 100644 --- a/historic/jam/src/builtins.c +++ b/historic/jam/src/builtins.c @@ -375,6 +375,12 @@ void load_builtins() builtin_pad, 0, args ); } + { + char * args[] = { "targets", "*", 0 }; + bind_builtin( "PRECIOUS", + builtin_precious, 0, args ); + } + /* Initialize builtin modules. */ init_set(); init_path(); @@ -1685,6 +1691,20 @@ LIST *builtin_pad( PARSE *parse, FRAME *frame ) } } +LIST *builtin_precious( PARSE *parse, FRAME *frame ) +{ + LIST* targets = lol_get(frame->args, 0); + + for ( ; targets; targets = list_next( targets ) ) + { + TARGET* t = bindtarget (targets->string); + t->flags |= T_FLAG_PRECIOUS; + } + + return L0; +} + + #ifdef HAVE_PYTHON LIST * builtin_python_import_rule( PARSE * parse, FRAME * frame ) diff --git a/historic/jam/src/builtins.h b/historic/jam/src/builtins.h index ba37b87ea..1edaab738 100644 --- a/historic/jam/src/builtins.h +++ b/historic/jam/src/builtins.h @@ -59,6 +59,7 @@ LIST *builtin_shell( PARSE *parse, FRAME *frame ); LIST *builtin_md5( PARSE *parse, FRAME *frame ); LIST *builtin_file_open( PARSE *parse, FRAME *frame ); LIST *builtin_pad( PARSE *parse, FRAME *frame ); +LIST *builtin_precious( PARSE *parse, FRAME *frame ); void backtrace( FRAME *frame ); diff --git a/historic/jam/src/make1.c b/historic/jam/src/make1.c index 26ee5c41e..8001f3339 100644 --- a/historic/jam/src/make1.c +++ b/historic/jam/src/make1.c @@ -839,12 +839,20 @@ static void make1d( state * pState ) /* If the command was interrupted or failed and the target is not * "precious", remove the targets. */ - if ( ( status != EXEC_CMD_OK ) && !( cmd->rule->actions->flags & RULE_TOGETHER ) ) + if (status != EXEC_CMD_OK) { LIST * targets = lol_get( &cmd->args, 0 ); for ( ; targets; targets = list_next( targets ) ) - if ( !unlink( targets->string ) ) + { + int need_unlink = 1; + TARGET* t = bindtarget ( targets->string ); + if (t->flags & T_FLAG_PRECIOUS) + { + need_unlink = 0; + } + if (need_unlink && !unlink( targets->string ) ) printf( "...removing %s\n", targets->string ); + } } /* Free this command and call make1c() to move onto the next one scheduled diff --git a/historic/jam/src/rules.h b/historic/jam/src/rules.h index 9ad4171b6..78e056202 100644 --- a/historic/jam/src/rules.h +++ b/historic/jam/src/rules.h @@ -166,6 +166,8 @@ struct _target */ #define T_FLAG_ISFILE 0x0400 +#define T_FLAG_PRECIOUS 0x0800 + char binding; /* how target relates to a real file or * folder */