mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* kbuild: libraries and subdirectories
@ 2005-09-08 13:40 Budde, Marco
  2005-09-08 15:28 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Budde, Marco @ 2005-09-08 13:40 UTC (permalink / raw)
  To: linux-kernel

I have a large number of sources files, which I have to
compile into one kernel module. Let's assume I have the
following source organisation:

  main/
    main_code.c
  lib1/
    part1/
      file_1_1_1.c
    part2/
      file_1_2_1.c
  lib2/
    part1/
      file_2_1_1.c
    part2/
      file_2_2_1.c

I would like to build all source files in lib1 into one
lib.a library and all files in lib2 into a second lib.a
library.

At the end I would like to compile the code in main and
link every together (result should be one kernel module).

How can I archieve this with kbuild? Its documentation is not
really deep.

I have added to all subdirectories kbuild files looking like
this:

   lib-m = file_1_1_1.c

This works and creates lib.a archives. In fact I have got
two problems:

 *) How can I tell kbuild in lib1 and lib2 to descend into
    the part directories?

 *) How can I link the libraries of the part directories into
    libs in the lib directories?

cu, Marco


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

* Re: kbuild: libraries and subdirectories
  2005-09-08 13:40 kbuild: libraries and subdirectories Budde, Marco
@ 2005-09-08 15:28 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2005-09-08 15:28 UTC (permalink / raw)
  To: Budde, Marco; +Cc: linux-kernel

On Thu, Sep 08, 2005 at 03:40:59PM +0200, Budde, Marco wrote:
> I have a large number of sources files, which I have to
> compile into one kernel module. Let's assume I have the
> following source organisation:
> 
>   main/
>     main_code.c
>   lib1/
>     part1/
>       file_1_1_1.c
>     part2/
>       file_1_2_1.c
>   lib2/
>     part1/
>       file_2_1_1.c
>     part2/
>       file_2_2_1.c
> 
> I would like to build all source files in lib1 into one
> lib.a library and all files in lib2 into a second lib.a
> library.

kbuild is optimised for kernel usage.
And within the kernel only xfs and oprofile (+a few others)
have files spread over more than one directory like in your
example. This is not considered good practice and therefore
kbuild does not document this usage - neither encourage it.

Also kbuild does not support building .a file in the way you
want it to do.

You can do the following:
obj-$(CONFIG_foo) += main/main_code.o
obj-$(CONFIG_foo) += lib1/part1/file_1_1_1.c
obj-$(CONFIG_foo) += lib1/part2/file1_2_1.o

etc.

> 
> At the end I would like to compile the code in main and
> link every together (result should be one kernel module).
> 
> How can I archieve this with kbuild? Its documentation is not
> really deep.
Please point out in what section you miss information and I will try to
update it.
I for one consider the kbuild syntax well documented, but I may be a bit
biased in this respect.

	Sam

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

end of thread, other threads:[~2005-09-08 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-08 13:40 kbuild: libraries and subdirectories Budde, Marco
2005-09-08 15:28 ` Sam Ravnborg

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

all inboxes | Powered by JetHome®