Make error

Link to this post 09 Sep 09


I got an error "No rule to make target " while running the make. Please see the make output below.

Room:/home/room/Desktop/net # make
make -C /lib/modules/ SUBDIRS=/home/room/Desktop/net modules
make[1]: Entering directory `/usr/src/linux-'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/usr/src/linux-'
make: *** [all] Error 2
Room:/home/room/Desktop/net #

The Makefile having the below lines.

obj-m :=lin_net_device.o
obj-m +=lin_net1.o
obj-m +=lin_net2.o

KDIR= /lib/modules/$(shell uname -r)/build

$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
rm -rf *.o *.mod.* .c* .t*
rm -rf *.o *.mod.* .c* .t* *.ko

Can you please help me on this.

Link to this post 20 Sep 09

Looks like the line
>$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
is being interpreted out so $PWD modules is not coming out the way you want. Change it to

$(MAKE) -C $(KDIR) SUBDIRS=$(PWD)/modules (ie get rid of the space, and replace it with a /) and you should be OK.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Linux Training / Board