+ -
当前位置:首页 → 问答吧 → 模块编程里makefile的错误

模块编程里makefile的错误

时间:2003-06-03

来源:互联网

到底我的makefile里什么地方写错了?

这是helloworld程序:
/*hello.c*/
#include <linux/kernel.h>
#include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif

int init_module()
{
printk("hello world --this is the kernel speaking\n");
return 0;
}

void cleanup_module()
{
printk("short is the life of a kernel module\n");
}

这是makefile的内容:
CC=gcc
CFLAGS:= -Wall -DMODULE -D_KERNEL_ -DLINUX
hello.o : hello.c /usr/include/linux/version.h
$(CC) $(CFLAGS) -c hello.c
为什么我在xterm下一执行make就有这样的错误:
makefile:4: *** missing separator. Stop.

作者: alittlekid   发布时间: 2003-06-03

Makefile的格式!请执行info make,仔细阅读Introduction部分,Rule Introduction章节,尤其注意这句话:
A "command" is an action that `make' carries out. A rule may have
more than one command, each on its own line. *Please note:* you need
to put a tab character at the beginning of every command line! This is
an obscurity that catches the unwary.

作者: moonlight   发布时间: 2003-06-04

检查这一行:
hello.o : hello.c /usr/include/linux/version.h

作者: kancon   发布时间: 2003-06-10

热门下载

更多