Skip to content
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

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions bpf/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# when updating this file, make sure to update `BPF_SRCFILES_IGNORE` in `Makefile.defs`
cilium-map-migrate
cilium-probe-kernel-hz
compile_commands.json
*.i
*.s
.rebuild_all
11 changes: 10 additions & 1 deletion bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

include ../Makefile.defs

.PHONY: all bpf_all build_all subdirs install clean
.PHONY: all bpf_all build_all subdirs install clean gen_compile_commands

SUBDIRS = sockops custom

Expand Down Expand Up @@ -318,3 +318,12 @@ clean:
$(MAKE) $(SUBMAKEOPTS) -C $(TARGET) clean;)
$(QUIET)rm -fr *.o *.ll *.i *.s
$(QUIET)rm -f $(TARGET)


BEAR_CLI = $(shell which bear 2> /dev/null)
gen_compile_commands:
Copy link
Contributor

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)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment in pr.

ifeq (, $(BEAR_CLI))
@echo "bear cli must be in $PATH to generate json compilation database"
else
bear -- make
endif