misc: add knob to generate compile_commands.json 60/26960/3
authorDamjan Marion <damarion@cisco.com>
Fri, 8 May 2020 17:01:22 +0000 (19:01 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 8 May 2020 17:54:26 +0000 (17:54 +0000)
Used for lanuguage servers like clangd and ccls

Type: improvement
Change-Id: I68d534dfa7b8ba3459fbd919d5ffccaa1fa1171e
Signed-off-by: Damjan Marion <damarion@cisco.com>
.gitignore
Makefile

index 3e9a92e..ea33024 100644 (file)
@@ -84,6 +84,10 @@ GTAGS
 /sphinx_venv
 !/docs/Makefile
 
+# language servers
+compile_commands.json
+.clangd
+
 # indent backup files
 *.BAK
 
index bf9cfcc..84f137e 100644 (file)
--- 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