LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

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

Rep: Reputation: 0
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
 
  


Reply

Tags
makefile


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 03:57 PM
how to write makefile for a project greghua Programming 3 01-14-2006 07:26 AM
How to write a Makefile mab_123 Linux - Software 1 07-06-2005 12:31 PM
How to write makefile to create shared library in 2.6 kernel yogeshwar_s Linux - Software 1 12-29-2004 01:39 AM
How to write a Makefile? lpriyamb Linux - Software 2 10-15-2003 05:11 AM


All times are GMT -5. The time now is 03:43 PM.

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