diff --git a/src/engine/command.c b/src/engine/command.c index 2c5a9d4c2..806b9db9f 100644 --- a/src/engine/command.c +++ b/src/engine/command.c @@ -35,6 +35,7 @@ CMD * cmd_new( RULE * rule, LIST * targets, LIST * sources, LIST * shell ) cmd->rule = rule; cmd->shell = shell; cmd->next = 0; + cmd->noop = 0; lol_init( &cmd->args ); lol_add( &cmd->args, targets ); diff --git a/src/engine/command.h b/src/engine/command.h index 64e8519fb..52bfd26b3 100644 --- a/src/engine/command.h +++ b/src/engine/command.h @@ -53,6 +53,7 @@ struct _cmd LIST * shell; /* $(JAMSHELL) value */ LOL args; /* LISTs for $(<), $(>) */ string buf[ 1 ]; /* actual commands */ + int noop; /* no-op commands should be faked instead of executed */ }; CMD * cmd_new diff --git a/src/engine/execcmd.h b/src/engine/execcmd.h index e8a1abb49..7b20b3266 100644 --- a/src/engine/execcmd.h +++ b/src/engine/execcmd.h @@ -52,7 +52,7 @@ int exec_check /* exec_check() return codes. */ #define EXEC_CHECK_OK 101 -#define EXEC_CHECK_SKIP 102 +#define EXEC_CHECK_NOOP 102 #define EXEC_CHECK_LINE_TOO_LONG 103 #define EXEC_CHECK_TOO_LONG 104 diff --git a/src/engine/execnt.c b/src/engine/execnt.c index 5f5a9bea5..54881d44d 100644 --- a/src/engine/execnt.c +++ b/src/engine/execnt.c @@ -226,7 +226,7 @@ int exec_check char const * s = command->value; while ( isspace( *s ) ) ++s; if ( !*s ) - return EXEC_CHECK_SKIP; + return EXEC_CHECK_NOOP; } /* Check prerequisites for executing raw commands. */ @@ -246,7 +246,7 @@ int exec_check return EXEC_CHECK_TOO_LONG; } else - return raw_cmd_length ? EXEC_CHECK_OK : EXEC_CHECK_SKIP; + return raw_cmd_length ? EXEC_CHECK_OK : EXEC_CHECK_NOOP; } /* Now we know we are using an external shell. Note that there is no need to diff --git a/src/engine/execunix.c b/src/engine/execunix.c index 83a85f1f2..ae1cdd7cf 100644 --- a/src/engine/execunix.c +++ b/src/engine/execunix.c @@ -116,7 +116,7 @@ int exec_check * know what they are going to do with such commands. */ if ( !command->size && ( is_raw_cmd || list_empty( *pShell ) ) ) - return EXEC_CHECK_SKIP; + return EXEC_CHECK_NOOP; return is_raw_cmd ? EXEC_CHECK_OK diff --git a/src/engine/make1.c b/src/engine/make1.c index ca93d213f..a4ee2b9c3 100644 --- a/src/engine/make1.c +++ b/src/engine/make1.c @@ -557,15 +557,26 @@ static void make1c( state * pState ) /* Increment the jobs running counter. */ ++cmdsrunning; - /* Execute the actual build command. */ - exec_cmd( cmd->buf, make_closure, t, cmd->shell, rule_name, - target_name ); - - /* Wait until under the concurrent command count limit. */ - assert( 0 < globs.jobs ); - assert( globs.jobs <= MAXJOBS ); - while ( cmdsrunning >= globs.jobs ) - exec_wait(); + /* Execute the actual build command or fake it if no-op. */ + if ( cmd->noop ) + { + timing_info time_info = { 0 } ; + time_info.start = time_info.end = time( 0 ); + out_action( rule_name, target_name, cmd->buf->value, "", "", + EXIT_OK ); + make_closure( t, EXEC_CMD_OK, &time_info, cmd->buf->value, "" ); + } + else + { + exec_cmd( cmd->buf, make_closure, t, cmd->shell, rule_name, + target_name ); + + /* Wait until under the concurrent command count limit. */ + assert( 0 < globs.jobs ); + assert( globs.jobs <= MAXJOBS ); + while ( cmdsrunning >= globs.jobs ) + exec_wait(); + } } } else @@ -1076,9 +1087,10 @@ static CMD * make1cmds( TARGET * t ) { accept_command = 1; } - else if ( cmd_check_result == EXEC_CHECK_SKIP ) + else if ( cmd_check_result == EXEC_CHECK_NOOP ) { - /* Simply release the prepared command. */ + accept_command = 1; + cmd->noop = 1; } else if ( ( actions->flags & RULE_PIECEMEAL ) && ( chunk > 1 ) ) {