Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kernel programming: No rule to make target `−C'

I am trying to learn kernel programming but while trying to compile a simple hello world program i am getting the following error.

make −C /lib/modules/3.2.0-67-generic/build M=/home/arun/KPrograms modules make[1]: Entering directory /home/arun/KPrograms' make[1]: *** No rule to make target−C'. Stop. make[1]: Leaving directory `/home/arun/KPrograms' make: * [all] Error 2

my Makefile is

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
like image 819
user3864733 Avatar asked Aug 03 '26 23:08

user3864733


2 Answers

You should replace all the −C in Makefile into -C. The dash character is incorrect.

like image 124
timrau Avatar answered Aug 06 '26 21:08

timrau


Hi all,

You must type your code on your own. In some cases copy paste does not work. You must enter it like this:

obj-m............<enter>

all:....<enter>

<tab>make -C.............<enter>

clean:..............<enter>

<tab>make -C...........<esc> <:wq>

That will probably solve your problem. good luck

like image 41
NGG Avatar answered Aug 06 '26 20:08

NGG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!