All of lore.kernel.org
 help / color / mirror / Atom feed
* kbuild - building a module/target from multiple directories
@ 2002-07-20  0:25 John Levon
  2002-07-20  0:46 ` Thunder from the hill
  2002-07-20  1:23 ` Kai Germaschewski
  0 siblings, 2 replies; 9+ messages in thread
From: John Levon @ 2002-07-20  0:25 UTC (permalink / raw)
  To: linux-kernel


With kbuild in 2.5, how do I specify that a module/target is to be built of
object files and sub-directories ?

The "obvious" approach :

obj-$(CONFIG_BLAH) := blah.o

blah-objs := blah_init.o blahstuff/

doesn't work. Is there an example of a module doing this ?

findall Makefile | xargs grep '+=' | grep -- -objs | awk -F: '{print $2}' | grep /
isn't promising ...

I'd like to avoid the awkwardness of multiple modules and the
unpleasantness of too many files in a single directory

thanks
john

-- 
"Of all manifestations of power, restraint impresses the most."
	- Thucydides

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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  0:25 kbuild - building a module/target from multiple directories John Levon
@ 2002-07-20  0:46 ` Thunder from the hill
  2002-07-20  1:22   ` John Levon
  2002-07-20  1:23 ` Kai Germaschewski
  1 sibling, 1 reply; 9+ messages in thread
From: Thunder from the hill @ 2002-07-20  0:46 UTC (permalink / raw)
  To: John Levon; +Cc: linux-kernel

Hi,

On Sat, 20 Jul 2002, John Levon wrote:
> With kbuild in 2.5, how do I specify that a module/target is to be built of
> object files and sub-directories ?
> 
> The "obvious" approach :
> 
> obj-$(CONFIG_BLAH) := blah.o
> 
> blah-objs := blah_init.o blahstuff/
> 
> doesn't work. Is there an example of a module doing this ?

What about:

blah/Makefile:

blah-objs := blah_init.o blahstuff/blahstuff.o

blah/blahstuff/Makefile:

blahstuff-objs := blah_didel.o blah_dadel.o blah_dumm.o

?

							Regards,
							Thunder
-- 
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o?  K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y- 
------END GEEK CODE BLOCK------


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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  0:46 ` Thunder from the hill
@ 2002-07-20  1:22   ` John Levon
  2002-07-20  1:48     ` Thunder from the hill
  0 siblings, 1 reply; 9+ messages in thread
From: John Levon @ 2002-07-20  1:22 UTC (permalink / raw)
  To: linux-kernel

On Fri, Jul 19, 2002 at 06:46:57PM -0600, Thunder from the hill wrote:

> blah-objs := blah_init.o blahstuff/blahstuff.o

It won't descend to blahstuff/ directory then

(in fact it tries to build blahstuff/blahstuff.s)

regards
john

-- 
"Of all manifestations of power, restraint impresses the most."
	- Thucydides

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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  0:25 kbuild - building a module/target from multiple directories John Levon
  2002-07-20  0:46 ` Thunder from the hill
@ 2002-07-20  1:23 ` Kai Germaschewski
  2002-07-20  1:52   ` John Levon
  2002-07-24 13:21   ` David Woodhouse
  1 sibling, 2 replies; 9+ messages in thread
From: Kai Germaschewski @ 2002-07-20  1:23 UTC (permalink / raw)
  To: John Levon; +Cc: linux-kernel

On Sat, 20 Jul 2002, John Levon wrote:

> With kbuild in 2.5, how do I specify that a module/target is to be built of
> object files and sub-directories ?

Short answer: Don't.

> The "obvious" approach :
> 
> obj-$(CONFIG_BLAH) := blah.o
> 
> blah-objs := blah_init.o blahstuff/
> 
> doesn't work. Is there an example of a module doing this ?

Well, first of all I'd rather discourage doing so in general. However, XFS 
is split into subdirs, so you could probably take a look at their latest 
CVS to see how it's done.

Basically, use only one Makefile and

	blah-objs := blah_init.o blahstuff/blah1.o blahstuff/blah2.o ...

in there.

--Kai



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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  1:22   ` John Levon
@ 2002-07-20  1:48     ` Thunder from the hill
  0 siblings, 0 replies; 9+ messages in thread
From: Thunder from the hill @ 2002-07-20  1:48 UTC (permalink / raw)
  To: John Levon; +Cc: linux-kernel

Hi,

On Sat, 20 Jul 2002, John Levon wrote:
> It won't descend to blahstuff/ directory then

This was not the complete solution then. Of course you still have to 
descend into blahstuff this way, but you compile all the blahstuff 
together into blahstuff.o, then include that from the upper directory.

							Regards,
							Thunder
-- 
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o?  K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y- 
------END GEEK CODE BLOCK------


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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  1:23 ` Kai Germaschewski
@ 2002-07-20  1:52   ` John Levon
  2002-07-20  2:09     ` Kai Germaschewski
  2002-07-24 13:21   ` David Woodhouse
  1 sibling, 1 reply; 9+ messages in thread
From: John Levon @ 2002-07-20  1:52 UTC (permalink / raw)
  To: Kai Germaschewski; +Cc: linux-kernel

On Fri, Jul 19, 2002 at 08:23:36PM -0500, Kai Germaschewski wrote:

> > With kbuild in 2.5, how do I specify that a module/target is to be built of
> > object files and sub-directories ?
> 
> Short answer: Don't.

Why not ? Simply because kbuild can't handle it nicely ?

> 	blah-objs := blah_init.o blahstuff/blah1.o blahstuff/blah2.o ...

Hmmm, that "works" I suppose

thanks
john

-- 
"Of all manifestations of power, restraint impresses the most."
	- Thucydides

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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  1:52   ` John Levon
@ 2002-07-20  2:09     ` Kai Germaschewski
  0 siblings, 0 replies; 9+ messages in thread
From: Kai Germaschewski @ 2002-07-20  2:09 UTC (permalink / raw)
  To: John Levon; +Cc: linux-kernel

On Sat, 20 Jul 2002, John Levon wrote:

> On Fri, Jul 19, 2002 at 08:23:36PM -0500, Kai Germaschewski wrote:
> 
> > > With kbuild in 2.5, how do I specify that a module/target is to be built of
> > > object files and sub-directories ?
> > 
> > Short answer: Don't.
> 
> Why not ? Simply because kbuild can't handle it nicely ?

Well, if you see the parts of your project as really separate, it probably 
makes sense to do the modularization also at the module level, i.e. have 
your project use some number of modules which can be split into subdirs 
without problems.

If it's all logically only one thing (as linking it all into just one
module implies), then why not put it into just one directory - maybe using
some prefix to the filenames to distinguish separate entities (e.g.
lowlevel ll_* highlevel hl_*). drivers/net has 145 .c files, I doubt
you'll have more than that ;)

I made kbuild handle this case (in the way above) for XFS, but in a way
it's against the normal way how the source is organized in the kernel
tree, and I don't see a good reason to change that. Dirs are used as
higher level containers, like "fs" all file system-specific things and
then fs/{ext2,nfs,...} with one file system per dir.

--Kai



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

* Re: kbuild - building a module/target from multiple directories
  2002-07-20  1:23 ` Kai Germaschewski
  2002-07-20  1:52   ` John Levon
@ 2002-07-24 13:21   ` David Woodhouse
  2002-07-24 14:24     ` Kai Germaschewski
  1 sibling, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2002-07-24 13:21 UTC (permalink / raw)
  To: Kai Germaschewski; +Cc: John Levon, linux-kernel


kai@tp1.ruhr-uni-bochum.de said:
>  Basically, use only one Makefile and
> 	blah-objs := blah_init.o blahstuff/blah1.o blahstuff/blah2.o ... 

Er, don't the dependencies get screwed then, because it fails to create 
.blahstuff/blah1.o.flags, etc.?


--
dwmw2



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

* Re: kbuild - building a module/target from multiple directories
  2002-07-24 13:21   ` David Woodhouse
@ 2002-07-24 14:24     ` Kai Germaschewski
  0 siblings, 0 replies; 9+ messages in thread
From: Kai Germaschewski @ 2002-07-24 14:24 UTC (permalink / raw)
  To: David Woodhouse; +Cc: John Levon, linux-kernel

On Wed, 24 Jul 2002, David Woodhouse wrote:

> >  Basically, use only one Makefile and
> > 	blah-objs := blah_init.o blahstuff/blah1.o blahstuff/blah2.o ... 
> 
> Er, don't the dependencies get screwed then, because it fails to create 
> .blahstuff/blah1.o.flags, etc.?

No, just try it ;) (That's what I meant saying that I made it work...)

--Kai


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

end of thread, other threads:[~2002-07-24 14:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-20  0:25 kbuild - building a module/target from multiple directories John Levon
2002-07-20  0:46 ` Thunder from the hill
2002-07-20  1:22   ` John Levon
2002-07-20  1:48     ` Thunder from the hill
2002-07-20  1:23 ` Kai Germaschewski
2002-07-20  1:52   ` John Levon
2002-07-20  2:09     ` Kai Germaschewski
2002-07-24 13:21   ` David Woodhouse
2002-07-24 14:24     ` Kai Germaschewski

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.