Skip to content

Commit 6fc9aac

Browse files
Gnuroumasahir0y
authored andcommitted
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 <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 8fcd8d1 commit 6fc9aac

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
@@ -1980,7 +1980,7 @@ nsdeps: modules
19801980
quiet_cmd_gen_compile_commands = GEN $@
19811981
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
19821982

1983-
$(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
1983+
$(extmod_prefix)compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
19841984
$(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
19851985
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
19861986
$(call if_changed,gen_compile_commands)

0 commit comments

Comments
 (0)