Re: [PATCH] Documentation: kbuild: Add note about using (subst m,y)

From: Alexander Lobakin
Date: Tue Feb 28 2023 - 10:16:35 EST


From: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Date: Tue, 28 Feb 2023 17:30:09 +0900

> On Tue, Feb 28, 2023 at 12:13 PM David Gow <davidgow@xxxxxxxxxx> wrote:

[...]

>> +Example::
>> +
>> + #drivers/Makefile
>> + obj-$(subst m,y,$(CONFIG_HYPERV)) += hv/
>> +
>
>
> I think many subsystems simply do
>
> obj-y += hv/

This creates a ton of empty built-in.a, each of them is listed in the
Kbuild output. Someone may think that if a directory contains
built-in.a, then something was built there. Sure it's their problems,
but I'd prefer to not pollute the log and built-in.a contents when
possible (empty files are still listed there IIRC).

>
>
> I do not think we need to advertise hyperv's way
> since it does not look very pretty.
>
>
>
>
>
>
>
> Mostly, it looks like this:
>
>
> obj-y += kunit/
>
> and
>
> obj-$(CONFIG_KUNIT_HOOK) += hook.o
>
>
>
>
>
>
>
> Bikeshed:
>
> I think Linus' suggestion is OK, but
> the BSD style seems less ugly,
> of course, that is just a matter of style.
>
>
> obj-$(CONFIG_HYPERV:m=y) += kunit/

I'd vote for this one, it's compact and readable.

>
>
>
>
>> Kbuild also supports dedicated syntax, subdir-y and subdir-m, for
>> descending into subdirectories. It is a good fit when you know they
>> do not contain kernel-space objects at all. A typical usage is to let
>> --
>> 2.39.2.722.g9855ee24e9-goog
>>
>
>
> --
> Best Regards
> Masahiro Yamada
>

Thanks,
Olek