New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tooling: introduce target for generating json compilation database #17065
Conversation
both mainstream c language servers (clangd, ccls) require a json compilation database to function correctly. this patch adds a makefile target which utilizes the 'bear' cli to compile this json database. after the database is generated all code within the bpf directory is indexable by clangd and ccls allowing the tooling to work correctly. Signed-off-by: Louis DeLosSantos <louis@isovalent.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I known, we do not include support for specific IDE/dev tools in other parts of the build system. Should we really make an exception for this?
Also, make gen_compile_comands
is more to type than the command it invokes (bear -- make
).
|
||
|
||
BEAR_CLI = $(shell which bear 2> /dev/null) | ||
gen_compile_commands: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use the actual target (compile_commands.json
) here with the correct dependencies (presumably all C code in the directory)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment in pr.
@twpayne i was keeping the naming consistent with the way you do this in the kernel: https://github.com/torvalds/linux/tree/master/scripts/clang-tools Cant speak for other tools, but the c LSPs tie themselves to the code base tightly, so its typical, and almost mandatory that the build systems are aware of their existence. Tho, only via this json compilation database. |
If it's an optional dependency available to developers who need it, it seems fine to me. I don't think we're taking on a big maintenance burden from adding stuff like this. For a similar example, I added |
Changes only effect bpf Makefile, integration tests can be skipped. |
both mainstream c language servers (clangd, ccls) require a json compilation
database to function correctly.
this patch adds a makefile target which utilizes the 'bear' cli to
compile this json database.
after the database is generated all code within the bpf directory is
indexable by clangd and ccls allowing the tooling to work correctly.
Signed-off-by: Louis DeLosSantos louis@isovalent.com