All of lore.kernel.org
 help / color / mirror / Atom feed
* kbuild support to build one module with multiple separate components?
@ 2004-07-02 18:36 Song Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Song Wang @ 2004-07-02 18:36 UTC (permalink / raw)
  To: linux-kernel

Hi, Folks

I'm puzzled by the kbuild system in 2.6 kernel.
I want to write a kernel module, which consists of
several components. The module is produced by
linking these components. These components are located
in separate subdirectories (for example A, B,C). 
Each component is generated also by linking 
multiple files. (For example, a_1.c, a_2.c for
building A.o, b_1.c, b_2.c for building B.o, then A.o
and B.o
should be linked to produce mymodule.o) 

I know if I put all the files in a single directory
The makefile of the module looks like

obj-$(CONFIG_MYMODULE) += mymodule.o
mymodule-objs := a_1.o a_2.o b_1.o b_2.o c_1.o c_2.o

It should work. But it is really messy, especially
there are a lot of files or each component requires
different EXTRA_CFLAGS. However, if I write
separate Makefiles for each component in their own
subdirectory, the Makefile of component A looks like

obj-y := A.o (or obj-$(CONFIG_MYMODULE) +=  A.o)
A-objs := a_1.o a_2.o

This is wrong, because kbuild will treat A as
independent module. All I want is to treat
A as component of the only module mymodule.o. It
should be linked to mymodule.o

Any idea on how to write a kbuild Makefile to
support such kind of single module produced
by linking multiple components and each component
is located in separate directory? Thanks.

-Song




		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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

* kbuild support to build one module with multiple separate components?
@ 2004-07-06 23:00 Song Wang
  2004-07-09 21:57 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Song Wang @ 2004-07-06 23:00 UTC (permalink / raw)
  To: linux-mips

Hi, Folks

I'm puzzled by the kbuild system in 2.6 kernel.
I want to write a kernel module, which consists of
several components. The module is produced by
linking these components. These components are located
in separate subdirectories (for example A, B,C). 
Each component is generated also by linking 
multiple files. (For example, a_1.c, a_2.c for
building A.o, b_1.c, b_2.c for building B.o, then A.o
and B.o
should be linked to produce mymodule.o) 

I know if I put all the files in a single directory
The makefile of the module looks like

obj-$(CONFIG_MYMODULE) += mymodule.o
mymodule-objs := a_1.o a_2.o b_1.o b_2.o c_1.o c_2.o

It should work. But it is really messy, especially
there are a lot of files or each component requires
different EXTRA_CFLAGS. However, if I write
separate Makefiles for each component in their own
subdirectory, the Makefile of component A looks like

obj-y := A.o (or obj-$(CONFIG_MYMODULE) +=  A.o)
A-objs := a_1.o a_2.o

And the Makefile of mymodule looks like
obj-$(CONFIG_MYMODULE) +=  A/

This is wrong, because kbuild will treat A as
independent module. All I want is to treat
A as component of the only module mymodule.o. It
should be linked to mymodule.o

Any idea on how to write a kbuild Makefile to
support such kind of single module produced
by linking multiple components and each component
is located in separate directory? Thanks.

-Song




		
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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

* Re: kbuild support to build one module with multiple separate components?
  2004-07-06 23:00 kbuild support to build one module with multiple separate components? Song Wang
@ 2004-07-09 21:57 ` Ralf Baechle
  2004-07-14 21:59   ` Song Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2004-07-09 21:57 UTC (permalink / raw)
  To: Song Wang; +Cc: linux-mips

On Tue, Jul 06, 2004 at 04:00:50PM -0700, Song Wang wrote:

> This is wrong, because kbuild will treat A as
> independent module. All I want is to treat
> A as component of the only module mymodule.o. It
> should be linked to mymodule.o
> 
> Any idea on how to write a kbuild Makefile to
> support such kind of single module produced
> by linking multiple components and each component
> is located in separate directory? Thanks.

That's a limitation in the current kbuild system.  You either have to put
all files into a single directory or if you don't want that split your
module into several independant modules.  What I haven't tried is using
.a libraries but they're generally deprecated in kbuild.

  Ralf

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

* Re: kbuild support to build one module with multiple separate components?
  2004-07-09 21:57 ` Ralf Baechle
@ 2004-07-14 21:59   ` Song Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Song Wang @ 2004-07-14 21:59 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: sam, kbuild-devel, linux-kernel

Hi, Ralf

Thanks for the reply.

I looked through kbuild documentation. This is
a variable called lib-y to build .a, for instance,

lib-y := a.o, b.o

Then lib.a will be produced. However, in this case,
you can build a lib.a for each sub module, but
they will have the same name, I don't know how you
can link them together.

I think the current kbuild system does simplify 
the Makefiles in 2.6, but it also reduces the
flexibility.

-Song

--- Ralf Baechle <ralf@linux-mips.org> wrote:
> On Tue, Jul 06, 2004 at 04:00:50PM -0700, Song Wang
> wrote:
> 
> > This is wrong, because kbuild will treat A as
> > independent module. All I want is to treat
> > A as component of the only module mymodule.o. It
> > should be linked to mymodule.o
> > 
> > Any idea on how to write a kbuild Makefile to
> > support such kind of single module produced
> > by linking multiple components and each component
> > is located in separate directory? Thanks.
> 
> That's a limitation in the current kbuild system. 
> You either have to put
> all files into a single directory or if you don't
> want that split your
> module into several independant modules.  What I
> haven't tried is using
> .a libraries but they're generally deprecated in
> kbuild.
> 
>   Ralf
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-06 23:00 kbuild support to build one module with multiple separate components? Song Wang
2004-07-09 21:57 ` Ralf Baechle
2004-07-14 21:59   ` Song Wang
  -- strict thread matches above, loose matches on Subject: below --
2004-07-02 18:36 Song Wang

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.