linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-riscv@lists.infradead.org,
	Palmer Dabbelt <palmer@sifive.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Paul Walmsley <paul.walmsley@sifive.com>
Subject: Re: [PATCH] riscv: add arch/riscv/Kbuild
Date: Tue, 27 Aug 2019 14:14:59 +0900	[thread overview]
Message-ID: <CAK7LNAQ_5Hz_CXAdx8W0bLjMWQ08KDWK3gG2pfDZOEE+cr0KEw@mail.gmail.com> (raw)
In-Reply-To: <20190826113526.GA23425@infradead.org>

On Mon, Aug 26, 2019 at 8:35 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Wed, Aug 21, 2019 at 06:26:58PM +0900, Masahiro Yamada wrote:
> > Use the standard obj-y form to specify the sub-directories under
> > arch/riscv/. No functional change intended.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> Do you have a document what the grand scheme here is?

There is a small documentation about "Makefile" vs "Kbuild"
in Documentation/kbuild/modules.rst section 3.2

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

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.

Major architectures are already doing this.

See
arch/x86/Kbuild
arch/sparc/Kbuild
arch/powerpc/Kbuild
etc.

(and arm64 also adopted this recently)


The trick is "Kbuild" has precedence over "Makefile".

If you are interested in the actual code,
see line 41 of scripts/Makefile.build




>  Less of the magic
> in arch/$(ARCH)/Makefile sounds like a good idea, but unless we have
> a very specific split between the kbuild makefile and various override
> I fear just splitting things up into two files doesn't really help much.

Why not?


-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2019-08-27  5:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21  9:26 Masahiro Yamada
2019-08-26 11:35 ` Christoph Hellwig
2019-08-27  5:14   ` Masahiro Yamada [this message]
2019-08-30 15:53     ` Christoph Hellwig
2019-08-31 13:04       ` Masahiro Yamada
2019-09-02  7:42         ` Christoph Hellwig
2019-09-03 14:31           ` Masahiro Yamada
2019-08-31  0:51 ` Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNAQ_5Hz_CXAdx8W0bLjMWQ08KDWK3gG2pfDZOEE+cr0KEw@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --subject='Re: [PATCH] riscv: add arch/riscv/Kbuild' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).