Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 03-08-2007, 03:47 AM   #1
satish Chander
LQ Newbie
Registered: Mar 2007
Posts: 1

Rep: Reputation: 0
how to write Makefile for descending down in directories

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 )

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,



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write makefile for module in 2.6 kernel which builds and uses libraries videsh Linux - Distributions 1 01-19-2006 02:57 PM
how to write makefile for a project greghua Programming 3 01-14-2006 06:26 AM
How to write a Makefile mab_123 Linux - Software 1 07-06-2005 11:31 AM
How to write makefile to create shared library in 2.6 kernel yogeshwar_s Linux - Software 1 12-29-2004 12:39 AM
How to write a Makefile? lpriyamb Linux - Software 2 10-15-2003 04:11 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration