I am writing a simple Hello World kernel module. The Makefile I wrote is giving me such an error:
esp@ubuntu:~/task1-2$ make all
make -C /usr/src/linux-headers-3.13.0-35-generic SUBDIRS = /home/esp/task1-2 modules
make: ****** empty variable name. Stop.
make: ** [all] Error 2
How do I rectify it?
My Makefile:
obj-m += task1-2.o
KDIR = /usr/src/linux-headers-3.13.0-35-generic
all:
$(MAKE) -C $(KDIR) SUBDIRS = $(PWD) modules
clean:
rm -f *.o
rm -f *.ko
rm -f *.mod.*
rm -f *.symvers
rm -f *.order
Best Answer
The section 9.3 of the (GNU) Make manual describes overriding variables.
The problem is not with your makefile, but with the invocation. The argument that contains
=
is just=
. Make does not concatenate multiple arguments into one you should specify:SUBDIRS=/home/esp/task1-2
.