免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2875 | 回复: 8
打印 上一主题 下一主题

编写makefile以后 make不通过 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-09-19 20:32 |只看该作者 |倒序浏览
我的makefile是这么写的:
内核的源码在/home/juer/src/linux-2.6.25.16里面
PWD=$(shell pwd)
KERNEL_SRC=/home/juer/src/linux-2.6.25.16
obj-m :=ip46natForTest.o
module-objs :=ip46natForTest.o
all:
        $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
clean:
        rm *.ko
        rm *.o



报错:

root@juer:/home/juer/ip46natForTest# make
make: Warning: File `Makefile' has modification time 5.3e+04 s in the future
make -C /lib/modules/2.6.25.16juer/build M=/home/juer/ip46natForTest modules
make[1]: Entering directory `/home/juer/src/linux-2.6.25.16'
make[2]: Warning: File `/home/juer/ip46natForTest/Makefile' has modification time 5.3e+04 s in the future
make[2]: *** No rule to make target `/home/juer/ip46natForTest/ip46natForTest.c', needed by `/home/juer/ip46natForTest/ip46natForTest.o'.  Stop.
make[1]: *** [_module_/home/juer/ip46natForTest] Error 2
make[1]: Leaving directory `/home/juer/src/linux-2.6.25.16'
make: *** [default] Error 2


希望高手来指点下

论坛徽章:
0
2 [报告]
发表于 2010-09-19 20:47 |只看该作者
obj-m :=ip46natForTest.o
module-objs :=ip46natForTest.o

修改为
obj-m :=ip46natForTest.o
ip46natForTest-objs :=ip46natForTest.o

如果模块的依赖目标文件只有一个... 第二句话完全可以不要...

论坛徽章:
0
3 [报告]
发表于 2010-09-19 20:53 |只看该作者
回复 2# PCliangtao


    谢谢 我试试

论坛徽章:
0
4 [报告]
发表于 2010-09-19 20:56 |只看该作者
回复 2# PCliangtao


    貌似还是不行

论坛徽章:
0
5 [报告]
发表于 2010-09-19 20:59 |只看该作者
回复 2# PCliangtao

错误信息::
    root@juer:/home/juer/ip46natForTest# make
make: Warning: File `Makefile' has modification time 5.4e+04 s in the future
make -C /home/juer/src/linux-2.6.25.16 M=/home/juer/ip46natForTest modules
make[1]: Entering directory `/home/juer/src/linux-2.6.25.16'
make[2]: Warning: File `/home/juer/ip46natForTest/Makefile' has modification time 5.4e+04 s in the future
make[2]: Circular /home/juer/ip46natForTest/ip46natForTest.o <- /home/juer/ip46natForTest/ip46natForTest.o dependency dropped.
  LD [M]  /home/juer/ip46natForTest/ip46natForTest.o
ld: no input files
make[2]: *** [/home/juer/ip46natForTest/ip46natForTest.o] Error 1
make[1]: *** [_module_/home/juer/ip46natForTest] Error 2
make[1]: Leaving directory `/home/juer/src/linux-2.6.25.16'
make: *** [all] Error 2

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
6 [报告]
发表于 2010-09-20 10:16 |只看该作者
你的内核源码是编译过的吗?

论坛徽章:
0
7 [报告]
发表于 2010-09-21 22:19 |只看该作者
回复 6# Godbach


    需要是编译过的吗?貌似我的没编译过的也可以

论坛徽章:
0
8 [报告]
发表于 2010-09-25 18:20 |只看该作者
Entering directory `/home/juer/src/linux-2.6.25.16'                   //进入你的系统内核路径就出错了,要不这个本就没编译安装好过

论坛徽章:
0
9 [报告]
发表于 2010-09-26 09:46 |只看该作者
如果你只有一个.c 文件,则把这一句去掉:
module-objs :=ip46natForTest.o

如果你有两个以上的文件(假设分别是 a.c, b.c),则需要:
obj-m :=ip46natForTest.o
ip46natForTest-objs := a.o b.o
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP