bug-make
[Top][All Lists]
Advanced

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

Re: Idea: Add command-line option for reporting potential makefile error


From: Tim Murphy
Subject: Re: Idea: Add command-line option for reporting potential makefile errors
Date: Wed, 12 Jun 2019 19:22:09 +0100

If you use strace to detect dependencies you might have to do a thorough patent search. I will say no more because it's not my place to.

Regards

Tim

On Wed, 12 Jun 2019, 03:09 David A. Wheeler, <address@hidden> wrote:
Problem:

Makefiles often have errors, and they lay dormant because they're undetected.

On Tue, 11 Jun 2019 07:44:31 -0700, <address@hidden> 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
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-make

reply via email to

[Prev in Thread] Current Thread [Next in Thread]