PDA

View Full Version : [SOLVED] Building the simple module fails. -No rule to make target `−C'. Stop



ksuneel
October 29th, 2011, 08:34 PM
Registered: May 2005
Posts: 7

Rep:
Building the simple module fails. -No rule to make target `−C'. Stop
Here is my sample Hello world program.

****************Hello.c**************

#define MODULE
#include<linux/module.h>
#include<linux/kernel.h>


int init_module(void) {
printk("<1> Hello World \n");
return 0;
}

void cleanup_module(void)
{
printk("<1> Goodbuy World \n");
}

make file for that.

*********************Makefile********************* ******

obj−m:=hello.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

When I do make This is what I see.


make −C /lib/modules/3.0.0-12-generic/build M= modules
make[1]: Entering directory `/home/suneel/Samples'
make[1]: *** No rule to make target `−C'. Stop.
make[1]: Leaving directory `/home/suneel/Samples'
make: *** [all] Error 2


Please suggest some solution.

trent.josephsen
October 29th, 2011, 11:55 PM
I suggest using a text editor, and not something that transforms a simple hyphen into a Unicode minus sign (http://www.fileformat.info/info/unicode/char/2212/index.htm).

ksuneel
October 30th, 2011, 06:55 PM
Thank you very much for the answer. That's amazing catch. That fixed the problem. But still build was not successful

This is what I see in the build output


make[1]: leaving directory /usr/src/linux-headers.....
Building modules stage 2.
MODPOST 0 modules.

Any suggestion?

ksuneel
October 30th, 2011, 07:07 PM
I have retyped the whole make file again.Some Unicode characters are causing the problem. It works after retyping same thing in gedit. Thank you very much for your support.