[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240803125153.216030-1-gnurou@gmail.com>
Date: Sat, 3 Aug 2024 21:51:53 +0900
From: Alexandre Courbot <gnurou@...il.com>
To: Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>
Cc: linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org,
Alexandre Courbot <gnurou@...il.com>
Subject: [PATCH] Makefile: add $(srctree) to dependency of compile_commands.json target
When trying to build the compile_commands.json target from an external
module's 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 appears to be because gen_compile_commands.py is looked up using
relative path, which doesn't exist from the module's source tree.
Prefixing the dependency with $(srctree) fixes the problem.
Signed-off-by: Alexandre Courbot <gnurou@...il.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 8ad55d6e7b60..52d7dfe4212a 100644
--- a/Makefile
+++ b/Makefile
@@ -1980,7 +1980,7 @@ nsdeps: modules
quiet_cmd_gen_compile_commands = GEN $@
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
-$(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
+$(extmod_prefix)compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
$(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
$(call if_changed,gen_compile_commands)
--
2.46.0
Powered by blists - more mailing lists