public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* Combining several subdirectories into a single loadable module
@ 2008-04-09 14:18 Anatoli Tubman
  0 siblings, 0 replies; only message in thread
From: Anatoli Tubman @ 2008-04-09 14:18 UTC (permalink / raw)
  To: linux-kbuild

Hi all!

Sorry if this question is stupid, I'm new to this whole kbuild thing.

I have a kernel module with source scattered over several directories,
with a separate set of specific compilation flags for each directory.
How do I write Makefiles for it, assuming in-tree compilation?

Here's the situation in detail. Suppose I have this directory structure:

mymodule
mymodule/subdir1
mymodule/subdir1/source11.c
mymodule/subdir1/source12.c
...
mymodule/subdir1/source1N.c
mymodule/subdir2
mymodule/subdir2/source21.c
mymodule/subdir2/source22.c
...
mymodule/subdir2/source2M.c
...
mymodule/subdirK/sourceKL.c

Each subdirI needs to have its own Makefile with its own EXTRA_CFLAGS,
and all .o files created in subdirectories need be combined into single
mymodule.ko. How do I do that? There are no examples in the
documentation, nor in the kernel source.

The question could be subdivided in two.

1. How do I tell the build system to compile sourceIJ.c and then leave
   sourceIJ.o alone (do not include in the kernel, do not build a .ko)?

2. Given a set of already built sourceIJ.o files, how do I tell the
   build system to combine them into a single .ko without trying to
   compile the corresponding sources first? If I say something like

      mymodule-objs := subdir1/source11.o (etc)

   in mymodule/Makefile, the build system will try to compile
   subdir1/source11.c *with mymodule/Makefile*, which is wrong (I need
   it to be done with mymodule/subdir1/Makefile).

I also tried to build libraries (.a archives) instead of using
sourceIJ.o directly, but without success.

I tried to understand scripts/Makefile.build but it only gave me a
headache...

Regards
-- 
Anatoli Tubman
Connectra performance and infrastructure
Check Point Software Technologies

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-09 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-09 14:18 Combining several subdirectories into a single loadable module Anatoli Tubman

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