|
how to write Makefile for descending down in directories
Hi,
I am trying to write a New Makefile for 2.6 kernels for porting Linux 2.4 driver. My source code is spread across multiple directories. I want to build my driver as single insertable module.
Let me explain what I have.
My source contains following directories :
1) bin
2) src -> mac->(init.c,api.c)
-> common -> ( util.c )
ect
3)include
Bin has top-level Makefile. When I includes all the source files with relative path in this Makefile,It compiles fine and creates a .ko file in same directory.
But this type of approach is not recommended.
I want to have different make file for each sub directories and these should be invoked by master Makefile in /bin directory.
I added following code /bin/makefile to invoke respective makefiles in subdir.
obj-m += /src/mac
obj-m += /src/common
and subdir Makefile looks like this.
obj-m := mac.o
init-obj += init.o api.o
But it creates different .ko files in sub dir.
Is there any way I can achieve my requirement.
Thanks in advance,
-Satish
|