summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-05-08 19:01:22 +0200
committerFlorin Coras <florin.coras@gmail.com>2020-05-08 17:54:26 +0000
commit13bcb92e64f8c115c6182715723cd8773c7eacb6 (patch)
treef50e7b7ee5dcacf482722ea9232e86cc522530a2
parent599efc67e87e89666d44efd34b5d3db7ccf1f4ca (diff)
misc: add knob to generate compile_commands.json
Used for lanuguage servers like clangd and ccls Type: improvement Change-Id: I68d534dfa7b8ba3459fbd919d5ffccaa1fa1171e Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--.gitignore4
-rw-r--r--Makefile5
2 files changed, 9 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3e9a92e44ac..ea330241549 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,6 +84,10 @@ GTAGS
/sphinx_venv
!/docs/Makefile
+# language servers
+compile_commands.json
+.clangd
+
# indent backup files
*.BAK
diff --git a/Makefile b/Makefile
index bf9cfcc5344..84f137e242a 100644
--- a/Makefile
+++ b/Makefile
@@ -223,6 +223,7 @@ help:
@echo " ctags - (re)generate ctags database"
@echo " gtags - (re)generate gtags database"
@echo " cscope - (re)generate cscope database"
+ @echo " compdb - (re)generate compile_commands.json"
@echo " checkstyle - check coding style"
@echo " checkstyle-commit - check commit message format"
@echo " checkstyle-test - check test framework coding style"
@@ -654,6 +655,10 @@ gtags: ctags
cscope: cscope.files
@cscope -b -q -v
+.PHONY: compdb
+compdb:
+ @ninja -C build-root/build-vpp_debug-native/vpp -t compdb > compile_commands.json
+
.PHONY: checkstyle
checkstyle: checkfeaturelist
@build-root/scripts/checkstyle.sh