Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make yields “commands commence before first target” error [duplicate]

Tags:

makefile

I'm new to linux driver dev.

I'm writing helloworld driver.

here is the code:

#define MODULE
#define __KERNEL__
#include <module.h>
int init_module() 
{
 return 0;
}

void cleanup_module()
{
 return;
}

and here is makefile:

    CC=gcc
    MODFLAGS:= -O3 -Wall -DLINUX
    module.o: module.c
    $(CC) $(MODFLAGS) -c module.c

But when I run make command I have the following: makefile:3: * “commands commence before first target” error

whats wrong?

like image 325
user1284151 Avatar asked May 14 '12 17:05

user1284151


1 Answers

Remove the leading tabs in the makefile, from every line that isn't a command:

CC=gcc
MODFLAGS:= -O3 -Wall -DLINUX
module.o: module.c
    $(CC) $(MODFLAGS) -c module.c
like image 123
Beta Avatar answered Oct 14 '22 17:10

Beta