* [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target
@ 2024-08-04 5:50 Alexandre Courbot
2024-08-04 10:22 ` Nicolas Schier
2024-08-05 6:19 ` Masahiro Yamada
0 siblings, 2 replies; 5+ messages in thread
From: Alexandre Courbot @ 2024-08-04 5:50 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Alexandre Courbot
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 is because gen_compile_commands.py was previously looked up using a
relative path to $(srctree), but commit b1992c3772e6 ("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: b1992c3772e6 ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory")
Signed-off-by: Alexandre Courbot <gnurou@gmail.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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target
2024-08-04 5:50 [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target Alexandre Courbot
@ 2024-08-04 10:22 ` Nicolas Schier
2024-08-05 6:19 ` Masahiro Yamada
1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2024-08-04 10:22 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Masahiro Yamada, Nathan Chancellor, linux-kbuild, linux-kernel
On Sun, Aug 04, 2024 at 02:50:57PM +0900 Alexandre Courbot wrote:
> 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 is because gen_compile_commands.py was previously looked up using a
> relative path to $(srctree), but commit b1992c3772e6 ("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: b1992c3772e6 ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory")
> Signed-off-by: Alexandre Courbot <gnurou@gmail.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
>
thanks, looks good to me.
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target
2024-08-04 5:50 [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target Alexandre Courbot
2024-08-04 10:22 ` Nicolas Schier
@ 2024-08-05 6:19 ` Masahiro Yamada
2024-08-05 7:33 ` Alexandre Courbot
1 sibling, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2024-08-05 6:19 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel
On Sun, Aug 4, 2024 at 2:51 PM Alexandre Courbot <gnurou@gmail.com> wrote:
>
> When trying to build the compile_commands.json target from an external
> module's directory, the following error is displayed:
As I mentioned in v1, this issue only happens when using the kernel
directory built in a separate output directory (O=).
Unless you have a opposition, I will reword this sentence as follows:
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 b1992c3772e6 ("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: b1992c3772e6 ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory")
> Signed-off-by: Alexandre Courbot <gnurou@gmail.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
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target
2024-08-05 6:19 ` Masahiro Yamada
@ 2024-08-05 7:33 ` Alexandre Courbot
2024-08-06 5:34 ` Masahiro Yamada
0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Courbot @ 2024-08-05 7:33 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel
On Mon, Aug 5, 2024 at 3:20 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Sun, Aug 4, 2024 at 2:51 PM Alexandre Courbot <gnurou@gmail.com> wrote:
> >
> > When trying to build the compile_commands.json target from an external
> > module's directory, the following error is displayed:
>
>
> As I mentioned in v1, this issue only happens when using the kernel
> directory built in a separate output directory (O=).
>
> Unless you have a opposition, I will reword this sentence as follows:
>
> 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:
Sounds perfect! Thank you.
Alex.
>
>
>
>
>
>
> >
> > 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 b1992c3772e6 ("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: b1992c3772e6 ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory")
> > Signed-off-by: Alexandre Courbot <gnurou@gmail.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
> >
> >
>
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target
2024-08-05 7:33 ` Alexandre Courbot
@ 2024-08-06 5:34 ` Masahiro Yamada
0 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2024-08-06 5:34 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel
On Mon, Aug 5, 2024 at 4:34 PM Alexandre Courbot <gnurou@gmail.com> wrote:
>
> On Mon, Aug 5, 2024 at 3:20 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Sun, Aug 4, 2024 at 2:51 PM Alexandre Courbot <gnurou@gmail.com> wrote:
> > >
> > > When trying to build the compile_commands.json target from an external
> > > module's directory, the following error is displayed:
> >
> >
> > As I mentioned in v1, this issue only happens when using the kernel
> > directory built in a separate output directory (O=).
> >
> > Unless you have a opposition, I will reword this sentence as follows:
> >
> > 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:
>
> Sounds perfect! Thank you.
> Alex.
>
Applied to linux-kbuild/fixes.
Thanks.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-06 5:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-04 5:50 [PATCH v2] Makefile: add $(srctree) to dependency of compile_commands.json target Alexandre Courbot
2024-08-04 10:22 ` Nicolas Schier
2024-08-05 6:19 ` Masahiro Yamada
2024-08-05 7:33 ` Alexandre Courbot
2024-08-06 5:34 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox