Kernel Makefile

Sam Ravnborg sam at ravnborg.org
Sun Oct 26 16:18:33 CDT 2008


On Sun, Sep 28, 2008 at 10:49:44PM +0200, Alberich de megres wrote:
> Hi!
> 
> i'm new on linux developing.. and i want to start undertanding how kernel
> makefile works..
> 
> When you finish menuconfig, kernel goes throught subdirs listed in obj-y/m
> to get full list of subdir and it's objects to build. M akefile
> documentation tells if you want to add a subdir to descend when compiling
> you just add subdir/ in obj-m/y var, but  I cannot see how makefile build
> this list. anyone can point something to me?

It builds the list from the assignments to obj-y, obj-m that ends with a "/".
So the assignment:

	obj-y += foobar/

will tell kbuild that it need to visit the directory foobar
before it does the final link.

But usually you do not need to think about this stuff.
Keep all your files for a module in one dir as we do in
the kernel and create a MAkefile like done in the kernel.
Then it all just works.

PS. Please avoid any html formatting in your mails.

	Sam


More information about the Kernel-mentors mailing list