* [PATCH] Makefile: include scripts/ in compile_commands.json
@ 2026-02-17 13:56 Jonas Rebmann
2026-02-23 9:17 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Jonas Rebmann @ 2026-02-17 13:56 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann
Although in many cases, C files in scripts/ would, because they rely on
the host toolchain and no unusual compiler flags, work fine in clangd
without a compile commands database, the (typically cross) compile
commands of the first entry in compile_commands.json are applied as
defaults once generated via `make compile_commands.json`.
As valid .cmd files are already present in scripts/ and
gen_compile_commands.py supports reading all cmd files in a subtree
recursively, simply add scripts to the gen_compile_commands.py
invocation. All enabled code in scripts/ is now properly covered by
compile_commands.json
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 4296c97ef0..d76e375719 100644
--- a/Makefile
+++ b/Makefile
@@ -1461,7 +1461,7 @@ 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
+ $(BAREBOX_OBJS) $(if $(CONFIG_PBL_IMAGE),$(BAREBOX_PBL_OBJS),) scripts/ FORCE
$(call if_changed,gen_compile_commands)
PHONY += compile_commands.json
---
base-commit: 74393178faf08f8102c7c370ac310c29112e1137
change-id: 20260217-scripts-compile-commands-hack-762a8f440ff2
Best regards,
--
Jonas Rebmann <jre@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Makefile: include scripts/ in compile_commands.json
2026-02-17 13:56 [PATCH] Makefile: include scripts/ in compile_commands.json Jonas Rebmann
@ 2026-02-23 9:17 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-02-23 9:17 UTC (permalink / raw)
To: BAREBOX, Jonas Rebmann
On Tue, 17 Feb 2026 14:56:41 +0100, Jonas Rebmann wrote:
> Although in many cases, C files in scripts/ would, because they rely on
> the host toolchain and no unusual compiler flags, work fine in clangd
> without a compile commands database, the (typically cross) compile
> commands of the first entry in compile_commands.json are applied as
> defaults once generated via `make compile_commands.json`.
>
> As valid .cmd files are already present in scripts/ and
> gen_compile_commands.py supports reading all cmd files in a subtree
> recursively, simply add scripts to the gen_compile_commands.py
> invocation. All enabled code in scripts/ is now properly covered by
> compile_commands.json
>
> [...]
Applied, thanks!
[1/1] Makefile: include scripts/ in compile_commands.json
https://git.pengutronix.de/cgit/barebox/commit/?id=6c054d0060b9 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-23 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-17 13:56 [PATCH] Makefile: include scripts/ in compile_commands.json Jonas Rebmann
2026-02-23 9:17 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox