Re: [kbuild-devel] kbuild support to build one module with multiple separate components?

From: sam
Date: Mon Jul 19 2004 - 10:29:53 EST


On Wed, Jul 14, 2004 at 02:40:44PM -0700, Song Wang wrote:
> Hi, Sam
>
> Thanks for the reply.
>
> However, in the way you indicate, the
> mainmodule and each submodule will be built
> as separate kernel modules. You will get
> mainmodule.ko, a_sub_module.ko, b_sub_module.ko etc.
>
> This is not what I tried to get. I tried to
> build a single kernel module, which means that
> mainmodule.o, a_sub_module.o, b_sub_module.o
> should be linked together to produce the single
> module.

OK.

This is even simpler:

Makefile:

EXTRA_CFLAGS := -I $(obj)/include

module-y := file.o dir/file.o
obj-m := module.o


And then code your C files as usual.
Assumig you have a directory named include.
Include header files like this:
#include "header.h"


So you end up having:

module/file.c
module/Makefile
module/dir/file.c
module/include/header.h

And you use:
make -C kernelsrcdir M=$PWD
to compile your module.

If this does not solve your issue please say so.

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/