免费注册 查看新帖 |

Chinaunix

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

[驱动] 多文件内核模块Makefile问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-11-23 17:14 |只看该作者 |倒序浏览
文件目录
[root@fedora hello_multi]# tree
.
├── come.c
├── configs
│   ├── come.h
│   └── on.h
├── Makefile
└── on.c

[root@fedora hello_multi]#
[root@fedora hello_multi]# vim Makefile
  1 ################################
  2
  3 # sample from www.latelee.org
  4 #
  5 ################################
  6
  7 # debug or not
  8
  9 #### change your module name here
10 MODULE =GotoHell
11
12 #### change your objs here
13 $(MODULE)-objs := come.o on.o
14
15 ifneq ($(KERNELRELEASE), )
16 obj-m := $(MODULE).o
17 else
18 KERNELDIR ?= /usr/src/linux-3.4.7
19 PWD := $(shell pwd)
20
21 all:
22         $(MAKE) -C $(KERNELDIR) M=$(PWD) INCDIR=$(PWD)/configs modules
23 endif
24 clean:
25         rm -rf *.o *.ko *.mod.o *.mod.c *.symvers modul* *~
26 .PHONY: all clean install modules modules_install
27
~

错误信息
[root@fedora hello_multi]# make
make -C /usr/src/linux-3.4.7 M=/just_for_test/module/hello_multi INCDIR=/just_for_test/module/hello_multi/configs modules
make[1]: Entering directory `/usr/src/linux-3.4.7'
scripts/Makefile.build:312: target `/just_for_test/module/hello_multi/GotoHell' doesn't match the target pattern
  CC [M]  /just_for_test/module/hello_multi/GotoHell
gcc: fatal error: no input files
compilation terminated.
make[2]: *** [/just_for_test/module/hello_multi/GotoHell] Error 4
make[1]: *** [_module_/just_for_test/module/hello_multi] Error 2
make[1]: Leaving directory `/usr/src/linux-3.4.7'
make: *** [all] Error 2
[root@fedora hello_multi]#
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP