Skip to content

Commit 56ae359

Browse files
author
Herton R. Krzesinski
committed
Makefile: add $(srctree) to dependency of compile_commands.json target
JIRA: https://issues.redhat.com/browse/RHEL-107194 commit 6fc9aac Author: Alexandre Courbot <gnurou@gmail.com> Date: Sun Aug 4 14:50:57 2024 +0900 Makefile: add $(srctree) to dependency of compile_commands.json target When trying to build compile_commands.json for an external module against the kernel built in a separate output directory, the following error is displayed: make[1]: *** No rule to make target 'scripts/clang-tools/gen_compile_commands.py', needed by 'compile_commands.json'. Stop. This is because gen_compile_commands.py was previously looked up using a relative path to $(srctree), but commit b1992c3 ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory") stopped defining VPATH for external module builds. Prefixing gen_compile_commands.py with $(srctree) fixes the problem. Fixes: b1992c3 ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory") Signed-off-by: Alexandre Courbot <gnurou@gmail.com> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
1 parent e61bb3a commit 56ae359

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ nsdeps: modules
20082008
quiet_cmd_gen_compile_commands = GEN $@
20092009
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
20102010

2011-
$(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
2011+
$(extmod_prefix)compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
20122012
$(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \
20132013
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
20142014
$(call if_changed,gen_compile_commands)

0 commit comments

Comments
 (0)