Re: prob with 2.6 Makefile

From: Sam Ravnborg
Date: Mon Nov 14 2005 - 15:26:59 EST


Hi Sapna.
> I have a few doubs with the 2.6 makefile
> Suppose I have the following dir structure:
> maindir
> |
> -------
> | |
> subdir1 subdir2
>
> Now both of this subdirs have many .c files which are to be compiled and
> linked together to make final1.o & final2.o files in the subdirs
> subdir1 & subdir2 respectively.
>
> Now i want to link this two files subdir1/final1.o & subdir2/final2.o ,
> in the maindir to make file say final.o file in maindir .

I suppose we are here discussing an external project where you want to
build a single module.

kbuild (and the kbuild syntax) is optimized for the pattern seen most
often in the kernel. And only in very rare cases we have a module split
over more than one directory. In the nomal cases everything are kept
together.
fs/xfs is one example where we do split up the source code in several dirs.

So there are only two possibilities:
1) Do like the rest of the kernel and keep the files in one dir
2) Specify all .o files in the top-level kbuild (Makefile) file.
Like this:
obj-m := module.o
module-y := subdir1/foo.o
module-y += subdir1/bar.o
module-y += subdir2/fooo.o
module-y += subdir2/baro.o

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/