makefile 文件的命名会影响编译结果吗?

[复制链接]
 楼主| suxilong 发表于 2017-11-14 08:42 | 显示全部楼层 |阅读模式
大家好,初学Linux 驱动,有个问题不是很明白。

看过陈皓写过的 “跟我一起学 Makefile" 其中说: makefile 的文件可以命名为 “Makefile” 和“makefile”

再练习写hello world 驱动的时候,我将makefile 命名为两种不同的形式, 但发现大写的Makefile 可以编译通过,但是小写的makefile 编译时确出现 以下错误:

  1. make -C /lib/modules/4.10.0-28-generic/build  M=/home/seven/Templates/dirver/helloword modules
  2. make[1]: Entering directory '/usr/src/linux-headers-4.10.0-28-generic'
  3. scripts/Makefile.build:44: /home/seven/Templates/dirver/helloword/Makefile: No such file or directory
  4. make[2]: *** No rule to make target '/home/seven/Templates/dirver/helloword/Makefile'.  Stop.
  5. Makefile:1524: recipe for target '_module_/home/seven/Templates/dirver/helloword' failed
  6. make[1]: *** [_module_/home/seven/Templates/dirver/helloword] Error 2
  7. make[1]: Leaving directory '/usr/src/linux-headers-4.10.0-28-generic'
  8. makefile:5: recipe for target 'modules' failed
  9. make: *** [modules] Error 2


说没有找到Makefile 。

makefile 内如如下:
ifeq ($(KERNELRELEASE),)
        KERNELDIR ?= /lib/modules/$(shell uname -r)/build
        PWD := $(shell pwd)
modules:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module* modules*
.PHONY: modules modules_install clean
else
        obj-m := helloworld.o
endif

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
dirtwillfly 发表于 2017-11-17 08:55 | 显示全部楼层
Linux的shell是区分大小写的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:没有最差,只有最懒

55

主题

340

帖子

4

粉丝
快速回复 在线客服 返回列表 返回顶部