From: Anatoli Tubman <anatolit@checkpoint.com>
To: linux-kbuild@vger.kernel.org
Subject: Combining several subdirectories into a single loadable module
Date: Wed, 09 Apr 2008 17:18:46 +0300 [thread overview]
Message-ID: <47FCD046.4060706@checkpoint.com> (raw)
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
reply other threads:[~2008-04-09 14:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=47FCD046.4060706@checkpoint.com \
--to=anatolit@checkpoint.com \
--cc=linux-kbuild@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox