Re: [PATCH 19/23] kbuild: support building external modules in a separate build directory

From: Masahiro Yamada
Date: Sat Nov 09 2024 - 20:39:03 EST


On Sat, Oct 5, 2024 at 4:45 AM Nicolas Schier <nicolas@xxxxxxxxx> wrote:

> > > @@ -640,6 +648,7 @@ quiet_cmd_makefile = GEN Makefile
> > > } > Makefile
> > >
> > > outputmakefile:
> > > +ifeq ($(KBUILD_EXTMOD),)
> > > @if [ -f $(srctree)/.config -o \
> > > -d $(srctree)/include/config -o \
> > > -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
> > > @@ -649,7 +658,16 @@ outputmakefile:
> > > echo >&2 "***"; \
> > > false; \
> > > fi
> > > - $(Q)ln -fsn $(srctree) source
> > > +else
> > > + @if [ -f $(KBUILD_EXTMOD)/modules.order ]; then \
>
> If I do
>
> make O=build
> touch fs/btrfs/modules.order
> make O=build M=fs/btrfs/ MO=/tmp/btrfs CONFIG_BTRFS_FS=m
>
> the 'modules.order' check does not work correctly. But a consequtive
>
> make -C /tmp/btrfs CONFIG_BTRFS_FS=m
>
> shows the 'The external module source tree is not clean.' message as
> expected.
>
> If I replace $(KBUILD_EXTMOD) by $(abs_extmodtree), it works for me also
> in the first case.

Right, this check does not work correctly
when KBUILD_EXTMOD is a relative path.

In v2, I changed this part.



--
Best Regards
Masahiro Yamada