LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 09-06-2012, 03:50 AM   #1
Sarvendu
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Rep: Reputation: Disabled
make: *** No targets specified and no makefile found. Stop.


I just step in into linix kernel development. I started reading the linux kenel development book downloaded from internet. I started with simple "Hello World" program as per book. I made the make file also as per book. Whenever, i am trying to compile it from terminal using make command, i am receiving "make: *** No targets specified and no makefile found. Stop." error. I am not sure what am i missing.

I am using "Ubuntu 12.04 LTS".

PS: Please provide me your thoughts/suggestions/solutions in simple format as i am new to linux kernel development.
 
Old 09-06-2012, 03:55 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
1. Ensure that the Makefile and your program, both, are in the same
directory.
2. Present your Makefile here along with the program.
3. Use Code tags.
 
Old 09-06-2012, 04:04 AM   #3
Sarvendu
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Both are in same folder. Please find below the code:

hello-1.c
=================================================================================
# include<module.h>

int init_module(void)
{

printk("Hello! This is my first application.");
return 0;
}

void cleanup_module(void)
{

printk("Thank You!");
}
==============================================================================

Make file:
==========================================================================================
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

==============================================================================================
 
Old 09-06-2012, 04:14 AM   #4
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
What exactly is the name of your Makefile? Exactly?
Secondly, the statements beneath `all:`, and `clean:` "should" start with a "tab".
 
Old 09-06-2012, 04:16 AM   #5
Sarvendu
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Q: What exactly is the name of your Makefile? Exactly?
A: make

Q: Secondly, the statements beneath `all:`, and `clean:` "should" start with a "tab".
A: Yes, they are.
 
Old 09-06-2012, 04:18 AM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Change the name of your Makefile to Makefile, and then compile again.

 
1 members found this post helpful.
Old 09-06-2012, 04:31 AM   #7
Sarvendu
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks for giving the solution of changing the name of file. However, after changing the name, it compiled and reported following errors.

make -C /lib/modules/3.2.0-29-generic-pae/build M=/home/likewise-open/Company/sarvendu/Desktop/HelloWorld modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-29-generic-pae'
CC [M] /home/likewise-open/Company/sarvendu/Desktop/HelloWorld/hello-1.o
/home/likewise-open/Company/sarvendu/Desktop/HelloWorld/hello-1.c:2:20: fatal error: module.h: No such file or directory
compilation terminated.
make[2]: *** [/home/likewise-open/Company/sarvendu/Desktop/HelloWorld/hello-1.o] Error 1
make[1]: *** [_module_/home/likewise-open/Company/sarvendu/Desktop/HelloWorld] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-29-generic-pae'
make: *** [all] Error 2
 
Old 09-06-2012, 04:35 AM   #8
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Rename that to:
Code:
#include <linux/module.h>
 
1 members found this post helpful.
Old 09-06-2012, 04:39 AM   #9
Sarvendu
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks a lot.
 
1 members found this post helpful.
Old 09-06-2012, 04:41 AM   #10
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Now, please, in future use "Code tags" for posting code.
Download this: http://www.gnu.org/software/make/manual/
 
  


Reply



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
make: *** No targets specified and no makefile found. Stop. Maryam Sajedi Linux - Newbie 4 08-07-2012 05:34 AM
[SOLVED] Installing libjpeg-turbo,make: *** No targets specified and no makefile found. Stop. Lumify Linux - Software 2 02-14-2012 07:15 AM
make: *** No targets specified and no makefile found. Stop. amritpalpathak Linux - Software 5 12-21-2011 02:27 AM
Problem installing MySQL 5.1.38: No targets specified and no makefile found. l33tmaster104 Linux - Newbie 7 09-12-2009 02:04 PM
*** No targets specified and no makefile found ritam_bkp Linux - Software 16 09-27-2008 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:01 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration