mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
common.mak: add compdb Makefile target
Add a new Makefile target 'compdb' to create the compilation database 'compile_commands.json' [1]. This file can then be used by the language server 'clangd' [2], which is a possible backend for the so called 'Language Server Protocol' (LSP) [3] used by many IDEs and editors. In addition, add this file to `.gitignore`. [1] https://clang.llvm.org/docs/JSONCompilationDatabase.html [2] https://clangd.llvm.org/ [3] https://microsoft.github.io/language-server-protocol/ Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
7e53611e3a
commit
3d098416c6
22
common.mak
22
common.mak
@@ -360,6 +360,7 @@ help:
|
||||
@echo ' all Build all tools (default target)'
|
||||
@echo ' install Install tools'
|
||||
@echo ' clean Delete all generated files'
|
||||
@echo ' compdb Generate compile_commands.json for clangd'
|
||||
@echo ''
|
||||
@echo 'OPTIONS'
|
||||
@echo ' D=1 Build with debugging option "-Og"'
|
||||
@@ -375,6 +376,27 @@ help:
|
||||
@echo ' # make C=1 CHECK=smatch'
|
||||
.PHONY: help
|
||||
|
||||
|
||||
# 'compile_commands.json' generation
|
||||
#
|
||||
# Create the compilation database 'compile_commands.json'. See
|
||||
# https://clang.llvm.org/docs/JSONCompilationDatabase.html for details.
|
||||
#
|
||||
.PHONY: compdb
|
||||
compdb:
|
||||
$(MAKE) clean
|
||||
ifneq ($(shell command -v compiledb),)
|
||||
compiledb $(MAKE)
|
||||
else ifneq ($(shell command -v bear),)
|
||||
ifeq ($(shell bear --help|grep -- '-- ...'),)
|
||||
bear $(MAKE)
|
||||
else
|
||||
bear -- $(MAKE)
|
||||
endif
|
||||
else
|
||||
$(error Please install either 'compiledb' or 'bear')
|
||||
endif
|
||||
|
||||
# Automatic dependency generation
|
||||
#
|
||||
# Create ".o.d" dependency files with the -MM compile option for all ".c" and
|
||||
|
||||
Reference in New Issue
Block a user