Re: Makefile question

Rasmus Villemoes <[email protected]> Thu, 5 Dec 2024 14:06:15 +0100
Newsgroups org.kernel.vger.smatch
Message-ID <CAKwiHFgUEVFhHhNq7JGJQCFOBhSuq8nkbofOC4eVfGmJE19U8w@mail.gmail.com>
On Thu, 5 Dec 2024 at 13:17, Oleg Drokin <[email protected]> wrote:
>
> On Thu, 2024-12-05 at 13:44 +0300, Dan Carpenter wrote:
> > I recently changed symbol.h
> >
> > https://lore.kernel.org/all/[email protected]/
> >
> > Ideally that would make basically every single file rebuild, but it
> > doesn't.  That means that "enum type" is wrong, which doesn't seem to
> > cause any crashes but it completely breaks the flow analysis so the
> > output is garbage.  Garbage output is way worse than crashing.
> >
> > Does anyone know how to fix Makefiles?
>
> Does not look like it's listed in the list of files that objects depend
> on?
> I am not sure what is LIB_H since it's not defined anywhere.
>
> There are various autodep tools to generate real dependencies, but I
> suspect you can just specify *.h so any header file rebuilds
> everything?

That would be overkill I think.

The Makefile already seems to have the proper logic for generating the
.foo.o.d dependency files, but I think the issue is at the end:

# GCC's dependencies
-include $(OBJS:%.o=.%.o.d)

and $(OBJS) does not contains $(SMATCH_OBJS).

Adding SMATCH_OBJS to OBJS may have some other random effects, so I
think the simplest is to just add another line

-include $(SMATCH_OBJS:%.o=.%.o.d)

Then touching any .h file should rebuild exactly the .c files using that.

Rasmus