Skip to content

Commit c80f100

Browse files
0xMALVEEkkourt
andcommitted
misc: 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 Co-authored-By: Kornilios Kourtis <[email protected]> Signed-off-by: M Alvee <[email protected]>
1 parent 19531d4 commit c80f100

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Makefile

Lines changed: 12 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,14 @@ 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+
@$(BEAR_CLI) $(MAKE) tetragon-bpf LOCAL_CLANG=1 LOCAL_CLANG_FORMAT=1
506+
endif

0 commit comments

Comments
 (0)