Skip to content

Commit 141b059

Browse files
committed
compile commands
misc: added make gen_compile_commands for tetragon Tetragon project doesn't have a command to generate compile_commands.json for clang. This commit fixes that by: 1. Adding make gen_compile_commands just like in cilium Fixes: #3697 Signed-off-by: M Alvee <[email protected]>
1 parent 19531d4 commit 141b059

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ kind: ## Create a kind cluster for Tetragon development.
349349
./contrib/kind/bootstrap-kind-cluster.sh
350350

351351
KIND_BUILD_IMAGES ?= 1
352-
VALUES ?=
352+
VALUES ?=
353353

354354
## kind-install-tetragon: ## Install Tetragon in a kind cluster.
355355
## kind-install-tetragon KIND_BUILD_IMAGES=0: ## Install Tetragon in a kind cluster without (re-)building images.
@@ -493,3 +493,16 @@ docs: ## Preview documentation website.
493493
.PHONY: version
494494
version: ## Print Tetragon version.
495495
@echo $(VERSION)
496+
497+
.PHONY: gen_compile_commands
498+
BEAR_CLI := $(shell which bear 2> /dev/null)
499+
gen_compile_commands: ## Generates compile_commands.json
500+
ifeq ($(BEAR_CLI),)
501+
@echo "Error: 'bear' must be installed and available in \$\$PATH to generate the compile_commands.json"
502+
@exit 1
503+
else
504+
@echo "Generating compile_commands.json using bear..."
505+
@export LOCAL_CLANG=1 && \
506+
export LOCAL_CLANG_FORMAT=1 && \
507+
$(BEAR_CLI) -- make tetragon-bpf
508+
endif

0 commit comments

Comments
 (0)