All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Michal Marek <mmarek@suse.com>, linux-kbuild@vger.kernel.org
Subject: Re: Behaviour of kernel makefiles when entering a subdir using a config symbol = m
Date: Wed, 9 Dec 2015 22:32:56 +0100	[thread overview]
Message-ID: <20151209213255.GA11031@ravnborg.org> (raw)
In-Reply-To: <56687204.4080404@ti.com>

On Wed, Dec 09, 2015 at 08:25:08PM +0200, Tomi Valkeinen wrote:
> Hi,
> 
> I wonder if this is as designed, or a bug:
> 
> I have a makefile which has
> 
> obj-$(CONFIG_FOO) += foo/
> 
> In the foo directory, I have a makefile which has
> 
> obj-$(CONFIG_FOO_BAR) += bar.o
> 
> The values of the variables are
> 
> CONFIG_FOO=m
> CONFIG_FOO_BAR=y
> 
> When building the kernel with the above setup, I would expect make to
> enter the foo/ directory, and build 'bar.o' into the kernel image.
> 
> And make does enter the directory, and does compile 'bar.o', but I think
> 'bar.o' doesn't end up anywhere. At least it's not compiled into the
> kernel image.
kbuild may enter a sub directory for two purposes:
1) to build object files to be part of the final image
   Only subdirs specified using obj-y is visited.

2) to build object files that will be included in a module
   Subdirs specified with obj-y and obj-m is visited

Since you have the following code in your Makefile:

    obj-m += foo/

then foo/ is only visited to build modules.

So bar.o is built but is NOT included in the final image.
This is also the behaviour you see.

	Sam

  reply	other threads:[~2015-12-09 21:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 18:25 Behaviour of kernel makefiles when entering a subdir using a config symbol = m Tomi Valkeinen
2015-12-09 21:32 ` Sam Ravnborg [this message]
2015-12-10  7:44   ` Tomi Valkeinen
2015-12-10 20:46     ` Sam Ravnborg
2015-12-11  9:31       ` Michal Marek

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=20151209213255.GA11031@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=tomi.valkeinen@ti.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.