tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] make: Also print -de error information when running multiple jobs



Hello all,

I recently submitted a minor make(1) change request to FreeBSD and
would like to suggest this upstream.
I've attached the patch rebased on the latest revision from
https://github.com/NetBSD/src.
Please let me know what you think.

Problem and patch description from https://reviews.freebsd.org/D29647:

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

Attachment: make-de-with-j.patch
Description: Binary data



Home | Main Index | Thread Index | Old Index