Problem: Makefiles often have errors, and they lay dormant because they're undetected.
On Tue, 11 Jun 2019 07:44:31 -0700, <th...@vmware.com> wrote: > Considering that many build systems created with Make do not properly > perform incremental builds (because all the necessary rules are not > written, or are written incorrectly), it's also a way to trivially > make a build that is mysteriously broken because one or more files > will not be properly rebuilt. Of course, that's a potential problem for *any* use of make. Garbage in, garbage out. I use automated dependency generation where I can, but the generators can have bugs & not all situations have a generator. Potential solution: Perhaps there should be a make flag that attempts to detect & warn about missing dependency information during make execution, to help people fix their makefiles. Basically, when running a rule, make could enable strace to see what is *actually* getting checked/read & written, compare that to what the rule *claims* are the prerequisites & targets, and then complain about differences. I did some brief experiments using: strace -f -e trace=%file gcc -o b.o b.c As expected, there are a huge number of special-case events. But if you only consider file-related events in a specific directory or down (which could probably default to the current directory), including relative paths, most of the events that would not normally go in a makefile disappear. It's also helped if you limit the set of system calls that need to be considered (e.g., openat is really important on Ubuntu). It might be much easier if this required other tools (like strace) to work, instead of directly implementing the tracing in make. This mechanism could be slow, but that's okay; I envision doing this checking occasionally, instead of doing it on every run. This might not be implemented on all platforms, but it would be useful on many platforms & help people fix their makefiles for all. --- David A. Wheeler _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make