4

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
  • You probably need to remove the space around the command-line variable assignment i.e. SUBDIRS=/home/esp/task1-2 – steeldriver Sep 6 '14 at 4:31
5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.