public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* build system: no module target ending with slash?
@ 2007-05-02 22:43 Christian Hesse
  2007-05-03  4:25 ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Hesse @ 2007-05-02 22:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Ketrenos

[-- Attachment #1: Type: text/plain, Size: 611 bytes --]

Hi James, hi everybody,

playing with iwlwifi I try to patch it into the kernel and to build it from 
there. But I have a problem with the build system.

The file drivers/net/wireless/mac80211/Makefile contains one single line:

obj-$(CONFIG_IWLWIFI)   += iwlwifi/

When CONFIG_IWLWIFI=m in scripts/Makefile.lib line 29 the target is filtered 
as it ends with a slash. That results in 
drivers/net/wireless/mac80211/built-in.o not being built and the build 
process breaks with an error. What is the correct way to handle this? Why are 
targets ending with a slash filtered?
-- 
Regards,
Chris

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: build system: no module target ending with slash?
  2007-05-02 22:43 build system: no module target ending with slash? Christian Hesse
@ 2007-05-03  4:25 ` Sam Ravnborg
  2007-05-03  6:15   ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2007-05-03  4:25 UTC (permalink / raw)
  To: Christian Hesse; +Cc: linux-kernel, James Ketrenos

On Thu, May 03, 2007 at 12:43:43AM +0200, Christian Hesse wrote:
> Hi James, hi everybody,
> 
> playing with iwlwifi I try to patch it into the kernel and to build it from 
> there. But I have a problem with the build system.
> 
> The file drivers/net/wireless/mac80211/Makefile contains one single line:
> 
> obj-$(CONFIG_IWLWIFI)   += iwlwifi/
> 
> When CONFIG_IWLWIFI=m in scripts/Makefile.lib line 29 the target is filtered 
> as it ends with a slash. That results in 
> drivers/net/wireless/mac80211/built-in.o not being built and the build 
> process breaks with an error. What is the correct way to handle this? Why are 
> targets ending with a slash filtered?

Looks buggy. I will take a look tonight.

	Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: build system: no module target ending with slash?
  2007-05-03  4:25 ` Sam Ravnborg
@ 2007-05-03  6:15   ` Sam Ravnborg
  2007-05-03  7:17     ` Christian Hesse
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2007-05-03  6:15 UTC (permalink / raw)
  To: Christian Hesse; +Cc: linux-kernel, James Ketrenos

On Thu, May 03, 2007 at 06:25:11AM +0200, Sam Ravnborg wrote:
> On Thu, May 03, 2007 at 12:43:43AM +0200, Christian Hesse wrote:
> > Hi James, hi everybody,
> > 
> > playing with iwlwifi I try to patch it into the kernel and to build it from 
> > there. But I have a problem with the build system.
> > 
> > The file drivers/net/wireless/mac80211/Makefile contains one single line:
> > 
> > obj-$(CONFIG_IWLWIFI)   += iwlwifi/
> > 
> > When CONFIG_IWLWIFI=m in scripts/Makefile.lib line 29 the target is filtered 
> > as it ends with a slash. That results in 
> > drivers/net/wireless/mac80211/built-in.o not being built and the build 
> > process breaks with an error. What is the correct way to handle this? Why are 
> > targets ending with a slash filtered?
> 
> Looks buggy. I will take a look tonight.
After some coffee...

Line 29 in Kbuild.include find all modules and a directory is not a module.
In line 26 in same file the directory iwlwifi is included in the list
of directories to visit.
So there is something else going on.

Anywhere I can get access to the combined source or could you try to post the full
Makefile.

	Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: build system: no module target ending with slash?
  2007-05-03  6:15   ` Sam Ravnborg
@ 2007-05-03  7:17     ` Christian Hesse
  2007-05-03 19:37       ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Hesse @ 2007-05-03  7:17 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, James Ketrenos

[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]

On Thursday 03 May 2007, Sam Ravnborg wrote:
> On Thu, May 03, 2007 at 06:25:11AM +0200, Sam Ravnborg wrote:
> > On Thu, May 03, 2007 at 12:43:43AM +0200, Christian Hesse wrote:
> > > Hi James, hi everybody,
> > >
> > > playing with iwlwifi I try to patch it into the kernel and to build it
> > > from there. But I have a problem with the build system.
> > >
> > > The file drivers/net/wireless/mac80211/Makefile contains one single
> > > line:
> > >
> > > obj-$(CONFIG_IWLWIFI)   += iwlwifi/
> > >
> > > When CONFIG_IWLWIFI=m in scripts/Makefile.lib line 29 the target is
> > > filtered as it ends with a slash. That results in
> > > drivers/net/wireless/mac80211/built-in.o not being built and the build
> > > process breaks with an error. What is the correct way to handle this?
> > > Why are targets ending with a slash filtered?
> >
> > Looks buggy. I will take a look tonight.
>
> After some coffee...
>
> Line 29 in Kbuild.include find all modules and a directory is not a module.
> In line 26 in same file the directory iwlwifi is included in the list
> of directories to visit.
> So there is something else going on.

In scripts/Kbuild.include line 26 is empty and line 29 is a comment... Do I 
look at the wrong place?

I still believe in my version: built-in.o is built if any of $(obj-y) $(obj-m) 
$(obj-n) $(obj-) $(lib-target) contains anything in scripts/Makefile.build 
line 77. As scripts/Makefile.lib line 29 filters the only target the object 
file is not built.

> Anywhere I can get access to the combined source or could you try to post
> the full Makefile.

I just generated a patch [0] against vanilla 2.6.21 with latest mac80211 and 
iwlwifi from git. Get my config [1] and you should get my error.

[0] http://www.eworm.de/tmp/iwlwifi.patch.bz2
[1] http://www.eworm.de/tmp/config-iwlwifi-2.6.21
-- 
Regards,
Chris

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: build system: no module target ending with slash?
  2007-05-03  7:17     ` Christian Hesse
@ 2007-05-03 19:37       ` Sam Ravnborg
  2007-05-04  8:56         ` Christian Hesse
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2007-05-03 19:37 UTC (permalink / raw)
  To: Christian Hesse; +Cc: linux-kernel, James Ketrenos

On Thu, May 03, 2007 at 09:17:15AM +0200, Christian Hesse wrote:
> On Thursday 03 May 2007, Sam Ravnborg wrote:
> > On Thu, May 03, 2007 at 06:25:11AM +0200, Sam Ravnborg wrote:
> > > On Thu, May 03, 2007 at 12:43:43AM +0200, Christian Hesse wrote:
> > > > Hi James, hi everybody,
> > > >
> > > > playing with iwlwifi I try to patch it into the kernel and to build it
> > > > from there. But I have a problem with the build system.
> > > >
> > > > The file drivers/net/wireless/mac80211/Makefile contains one single
> > > > line:
> > > >
> > > > obj-$(CONFIG_IWLWIFI)   += iwlwifi/
> > > >
> > > > When CONFIG_IWLWIFI=m in scripts/Makefile.lib line 29 the target is
> > > > filtered as it ends with a slash. That results in
> > > > drivers/net/wireless/mac80211/built-in.o not being built and the build
> > > > process breaks with an error. What is the correct way to handle this?
> > > > Why are targets ending with a slash filtered?
> > >
> > > Looks buggy. I will take a look tonight.
> >
> > After some coffee...
> >
> > Line 29 in Kbuild.include find all modules and a directory is not a module.
> > In line 26 in same file the directory iwlwifi is included in the list
> > of directories to visit.
> > So there is something else going on.
> 
> In scripts/Kbuild.include line 26 is empty and line 29 is a comment... Do I 
> look at the wrong place?
I looked at lxr.linux.no - so probarly an outdated version.

> 
> I still believe in my version: built-in.o is built if any of $(obj-y) $(obj-m) 
> $(obj-n) $(obj-) $(lib-target) contains anything in scripts/Makefile.build 
> line 77. As scripts/Makefile.lib line 29 filters the only target the object 
> file is not built.

I have applied your patch and tried it out.
The reason for the problem is the placeholder directory mac80211.
kbuild will not waste time building built-in.o for a directory where
it is not necessary. So for mac80211 no built-in.o is created since there
is no need. The only reference is to a module.

The quick-and-dirty workaround is to add a single 
obj-n := xx
in mac80211/Makefile and kbuild is happy again.


I could teach kbuild to create built-in.o also in the case
where we refer to a subdirectory only. But then we would end up with a built-in.o
in all directories where we have a kbuild MAkefile (almost) and that is
not desireable.
So I recommend the proposed workaround for now with a proper comment.

	Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: build system: no module target ending with slash?
  2007-05-03 19:37       ` Sam Ravnborg
@ 2007-05-04  8:56         ` Christian Hesse
  2007-05-04  9:47           ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Hesse @ 2007-05-04  8:56 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, James Ketrenos

[-- Attachment #1: Type: text/plain, Size: 2820 bytes --]

On Thursday 03 May 2007, Sam Ravnborg wrote:
> On Thu, May 03, 2007 at 09:17:15AM +0200, Christian Hesse wrote:
> > On Thursday 03 May 2007, Sam Ravnborg wrote:
> > > On Thu, May 03, 2007 at 06:25:11AM +0200, Sam Ravnborg wrote:
> > > > On Thu, May 03, 2007 at 12:43:43AM +0200, Christian Hesse wrote:
> > > > > Hi James, hi everybody,
> > > > >
> > > > > playing with iwlwifi I try to patch it into the kernel and to build
> > > > > it from there. But I have a problem with the build system.
> > > > >
> > > > > The file drivers/net/wireless/mac80211/Makefile contains one single
> > > > > line:
> > > > >
> > > > > obj-$(CONFIG_IWLWIFI)   += iwlwifi/
> > > > >
> > > > > When CONFIG_IWLWIFI=m in scripts/Makefile.lib line 29 the target is
> > > > > filtered as it ends with a slash. That results in
> > > > > drivers/net/wireless/mac80211/built-in.o not being built and the
> > > > > build process breaks with an error. What is the correct way to
> > > > > handle this? Why are targets ending with a slash filtered?
> > > >
> > > > Looks buggy. I will take a look tonight.
> > >
> > > After some coffee...
> > >
> > > Line 29 in Kbuild.include find all modules and a directory is not a
> > > module. In line 26 in same file the directory iwlwifi is included in
> > > the list of directories to visit.
> > > So there is something else going on.
> >
> > In scripts/Kbuild.include line 26 is empty and line 29 is a comment... Do
> > I look at the wrong place?
>
> I looked at lxr.linux.no - so probarly an outdated version.
>
> > I still believe in my version: built-in.o is built if any of $(obj-y)
> > $(obj-m) $(obj-n) $(obj-) $(lib-target) contains anything in
> > scripts/Makefile.build line 77. As scripts/Makefile.lib line 29 filters
> > the only target the object file is not built.
>
> I have applied your patch and tried it out.
> The reason for the problem is the placeholder directory mac80211.
> kbuild will not waste time building built-in.o for a directory where
> it is not necessary. So for mac80211 no built-in.o is created since there
> is no need. The only reference is to a module.

Agreed that it is not really needed. But if you don't build it you should not 
try to link it later...

> The quick-and-dirty workaround is to add a single
> obj-n := xx
> in mac80211/Makefile and kbuild is happy again.
>
> I could teach kbuild to create built-in.o also in the case
> where we refer to a subdirectory only. But then we would end up with a
> built-in.o in all directories where we have a kbuild MAkefile (almost) and
> that is not desireable.

I would prefer to teach it not to link object files that are not built.

> So I recommend the proposed workaround for now with a proper comment.

Ok, thanks for your help.
-- 
Regards,
Chris

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: build system: no module target ending with slash?
  2007-05-04  8:56         ` Christian Hesse
@ 2007-05-04  9:47           ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2007-05-04  9:47 UTC (permalink / raw)
  To: Christian Hesse; +Cc: linux-kernel, James Ketrenos

On Fri, May 04, 2007 at 10:56:14AM +0200, Christian Hesse wrote:
> Agreed that it is not really needed. But if you don't build it you should not 
> try to link it later...
> 
> > The quick-and-dirty workaround is to add a single
> > obj-n := xx
> > in mac80211/Makefile and kbuild is happy again.
> >
> > I could teach kbuild to create built-in.o also in the case
> > where we refer to a subdirectory only. But then we would end up with a
> > built-in.o in all directories where we have a kbuild MAkefile (almost) and
> > that is not desireable.
> 
> I would prefer to teach it not to link object files that are not built.

But you already _told_ kbuild that mac80211/ would contain a built-in.o
using following statement in drivers/net/wireless/Makefile:
obj-y += mac80211/

Changing this to obj-$(CONFIG_IWLWIFI) += mac80211/ would
give kbuild the _correct_ info.

obj-m += dir/
tell kbuild this directory contains a module so it will descend and build
obj-y += dir/
tall kbuild that directory contains stuff to be built-in and _maybe_ a module so
it will descend and build.

Note that when kbuild has entered a subdirectory it has lost knowledge of _how_
it came there so if you have lied to kbuild it will not detect it.
So in your case you told kbuild that there is stuff to be build in
in the mac80211/ dir which was incorrect.

	Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-04  9:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-02 22:43 build system: no module target ending with slash? Christian Hesse
2007-05-03  4:25 ` Sam Ravnborg
2007-05-03  6:15   ` Sam Ravnborg
2007-05-03  7:17     ` Christian Hesse
2007-05-03 19:37       ` Sam Ravnborg
2007-05-04  8:56         ` Christian Hesse
2007-05-04  9:47           ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox