Subject: Re: [PATCH 1/2] kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj)

From: Marc Zyngier <[email-masked]>
Date: Mon, 26 Aug 2019 10:17:22 +0100

On Sun, 25 Aug 2019 18:28:32 +0100,
Masahiro Yamada <[email-masked]> wrote:
> 
> Kbuild provides per-file compiler flag addition/removal:
> 
>   CFLAGS_<basetarget>.o
>   CFLAGS_REMOVE_<basetarget>.o
>   AFLAGS_<basetarget>.o
>   AFLAGS_REMOVE_<basetarget>.o
>   CPPFLAGS_<basetarget>
>   HOSTCFLAGS_<basetarget>.o
>   HOSTCXXFLAGS_<basetarget>.o
> 
> The <basetarget> is the filename of the target without its suffix.
> 
> This syntax comes into a trouble when two files with the same name
> appear in one Makefile, for example:
> 
>   obj-y += foo.o
>   obj-y += dir/foo.o
>   CFLAGS_foo.o := <some-flags>
> 
> Here, the <some-flags> applies to both foo.o and dir/foo.o
> 
> The real world problem is:
> 
>   scripts/kconfig/util.c
>   scripts/kconfig/lxdialog/util.c
> 
> Both files are compiled into scripts/kconfig/mconf, but only the
> latter should be given with additional flags for ncurses.
> 
> It is more sensible to use the relative path to the Makefile, like this:
> 
>   obj-y += foo.o
>   CFLAGS_foo.o := <some-flags>
>   obj-y += dir/foo.o
>   CFLAGS_dir/foo.o := <other-flags>
> 
> The $* variable is replaced with the stem ('%') part in a pattern rule.
> In other words, this only works for pattern rules.
> 
> Signed-off-by: Masahiro Yamada <[email-masked]>
> ---
> 
>  arch/arm/kvm/Makefile        |  5 +++--
>  arch/x86/entry/vdso/Makefile |  3 ++-
>  scripts/Makefile.host        | 30 +++++++++++++++---------------
>  scripts/Makefile.lib         | 10 +++++-----
>  scripts/kconfig/Makefile     |  8 ++++----
>  5 files changed, 29 insertions(+), 27 deletions(-)

For the KVM/arm part:

Acked-by: Marc Zyngier <[email-masked]>

Thanks,

	M.

-- 
Jazz is not dead, it just smells funny.

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel