I’m trying to write a makefile for a kernel module and cannot get it to work. Running the following has this output
$ make
make: Nothing to be done for 'all'.
but running the make command directly on the terminal results in
$ make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
make: Entering directory '/usr/src/linux-headers-3.5.0-17-generic'
CC [M] <blah>
Building modules, stage 2
<blah>
make: Leaving directory...
The contents of my Makefile are (source file is main.c)
obj-m += main.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
I do delete *.o and *.ko before trying to use the makefile. Changing all to default does nothing either.
The most likely issue is that you didn’t use a real tab character to begin the line reading
make -C ..., but instead used multiple spaces.makerequires that commands all begin with a tab character.