prob with 2.6 Makefile
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 .
So the Makefile in maindir looks like:
obj-m := subdir1/ subdir2/
This will traverse the subdir1 & subdir2 and call their makefiles. But how do i make final.o from subdir1/final1.o and subdir2/final2.o
Kindly help me with the solution.
Thanks in advance,
Regards,
Sapna
Hi Sapna.
Quoted 8 lines
I have a few doubs with the 2.6 makefile
Suppose I have the following dir structure:maindir | ------- | | subdir1 subdir2
Quoted 6 lines
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