help-make
[Top][All Lists]
Advanced

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

Re: On generating compilation databases


From: Paul Smith
Subject: Re: On generating compilation databases
Date: Mon, 02 Jan 2023 00:40:14 -0500
User-agent: Evolution 3.46.2 (by Flathub.org)

On Tue, 2022-12-06 at 15:56 +0100, Arsen Arsenović wrote:
> > > Do you have any implementation ideas?
> > 
> > Not really.  I see no feasible way that that generating
> > compile_commands.json could be built into make itself, so it would
> > need to be some kind of add-on package.  For people who are willing
> > or able to modify makefiles and reset appropriate variables such as
> > CC or CXX, that seems like quite a reasonable way forward.
> 
> I think formalizing and implementing the idea inside make could
> simplify the implementation, even if it can be an add-on (though,
> maybe actually trying to implement it would change my mind ;) ).

Possibly this could be implemented by automake, I won't speak to that
and you can investigate that with them.  But I really don't see how it
could be done by GNU make.  Make has no idea which rules build "object
files" (at least no innate knowledge) and even if it did, it doesn't
know which aspects of the recipe actually constitute the compile line:
many (most, these days) recipes which build object files are really
more complex shell scripts that also do all sort of other things like
manage dependency files, etc.

I don't think it's worth the effort to implement something like, "if
you do the simplest possible thing, and only then, we can generate a
compile_commands.json file for you".  If it doesn't work in general,
real-world environments it doesn't seem very useful.  And any special
markup that we could invent that makefile authors would have to add to
their makefiles to specify what should go into compile_commands.json,
if it couldn't be determined automatically, would be just as easily (if
not MORE easily) handled by some external tool as by make.



reply via email to

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