When running make -de (without any -j flag) bmake prints which command
failed. However, when using the -j flag the -de flag is ignored. This can
make it rather difficult to determine which command failed in an very
parallel build (especially when combined with the -s flag to avoid
ridiculously large logfiles). For single-threaded builds we can combine
-s with -de to get the failed command but this does not work with -jN
(even with -j1). This patch prints the failed shell script with -de in the
multiple jobs mode as well.
If we look at the following example makefile:
all: echo "Running all" if [ a = b ]; then \ echo "a = b"; \ else \ echo "a != b"; \ fi; false
Running make -de gives me the following output
Running all a != b *** Failed target: all *** Failed command: if [ a = b ]; then echo "a = b"; else echo "a != b"; fi; false *** Error code 1
Running make -de -j1 before:
Running all a != b *** [all] Error code 1
Running make -de -j1
Running all a != b *** Failed target: all *** Failed commands: echo "Running all" if [ a = b ]; then echo "a = b"; else echo "a != b"; fi; false *** [all] Error code 1
Since we pass the entire list of command for the target to the shell we
can't determine which of the multiple commands failed, but in most cases
this will be a single compiler command so printing the entire list should
be sufficient to debug the problem and allows me to use -s together with
-jN