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

    $(MAKE) -C $(KDIR) SUBDIRS = $(PWD) modules

    rm -f *.o
    rm -f *.ko
    rm -f *.mod.*
    rm -f *.symvers
    rm -f *.order
  • You probably need to remove the space around the command-line variable assignment i.e. SUBDIRS=/home/esp/task1-2 Sep 6, 2014 at 4:31

1 Answer 1


The section 9.3 of the (GNU) Make manual describes overriding variables.

An argument that contains ‘=’ specifies the value of a variable: ‘v=x’ sets the value of the variable v to x.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .