Re: [PATCH] riscv: add arch/riscv/Kbuild

From: Christoph Hellwig
Date: Fri Aug 30 2019 - 11:53:27 EST


On Tue, Aug 27, 2019 at 02:14:59PM +0900, Masahiro Yamada wrote:
> There is a small documentation about "Makefile" vs "Kbuild"
> in Documentation/kbuild/modules.rst section 3.2

I know that part.

>
> It is talking about external modules, but the benefit applies
> to arch/$(SRCARCH)/Kbuild as well.

I fail to fully understand this part, though.

> arch/$(SRCARCH)/Makefile is included by the top Makefile
> to specify arch-specific compiler flags, etc.
>
> On the other hand, arch/$(SRCARCH)/Kbuild, if exists, is included
> when Kbuild actually descends into arch/$(SRCARCH)/.
>
> This allows you to hierarchize the sub-directories to visit
> instead of specifying everything in flat in arch/$(SRCARCH)/Makefile.

Yes, but what is the plan in the long run? arch/$(ARCH)/Makefile
is still a weird hodge-podge of overriding global variables and misc
Makefile targets, it now just has a tiny little work. Is there any
actual benefit from using Kbuild for the build process? Can we
eventually move the setting of variables in the Makefile into another
special purpose file? Is the support for actually compiling kernel
source files from the arch/$(ARCH) Makefile eventually going away?