LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1141|回复: 2

模块编程里makefile的错误

[复制链接]
发表于 2003-6-3 17:29:26 | 显示全部楼层 |阅读模式
到底我的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.
发表于 2003-6-4 13:47:16 | 显示全部楼层
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.
发表于 2003-6-9 23:05:47 | 显示全部楼层
检查这一行:
hello.o : hello.c /usr/include/linux/version.h
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表