summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 14 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index ea1d5dae1c..f3c85cff94 100644
--- a/Makefile
+++ b/Makefile
@@ -541,7 +541,7 @@ endif
# in addition to whatever we do anyway.
# Just "make" or "make all" shall build modules as well
-ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
+ifneq ($(filter all _all modules %compile_commands.json,$(MAKECMDGOALS)),)
KBUILD_MODULES := 1
endif
@@ -1104,7 +1104,7 @@ endif # CONFIG_MODULES
CLEAN_DIRS += $(MODVERDIR)
CLEAN_FILES += barebox System.map include/generated/barebox_default_env.h \
.tmp_version .tmp_barebox* barebox.bin barebox.map barebox.S \
- .tmp_kallsyms* barebox.ldr \
+ .tmp_kallsyms* barebox.ldr compile_commands.json \
scripts/bareboxenv-target barebox-flash-image \
barebox.srec barebox.s5p barebox.ubl barebox.zynq \
barebox.uimage barebox.spi barebox.kwb barebox.kwbuart \
@@ -1162,6 +1162,18 @@ distclean: mrproper
-o -name 'core' \) \
-type f -print | xargs rm -f
+# Clang Tooling
+# ---------------------------------------------------------------------------
+
+quiet_cmd_gen_compile_commands = GEN $@
+ cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
+
+compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
+ $(BAREBOX_OBJS) $(if $(CONFIG_PBL_IMAGE),$(BAREBOX_PBL_OBJS),) FORCE
+ $(call if_changed,gen_compile_commands)
+
+PHONY += compile_commands.json
+
# Brief documentation of the typical targets used
# ---------------------------------------------------------------------------