为什么 make 打印是“make:无事可做‘所有’."? [英] Why is make printing "make: Nothing to be done for `all'."?

查看:12
本文介绍了为什么 make 打印是“make:无事可做‘所有’."?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个Hello.c"模块和Makefile".从 woking 目录执行 make 后,我收到以下消息:

This is a "Hello.c" module and "Makefile". After executing make from the woking directory I get the following message:

make:对'all'什么都不做.

make: Nothing to be done for `all'.

这是Hello.c"文件:

This is the "Hello.c" file:

#include <linux/module.h>    // included for all kernel modules
#include <linux/kernel.h>    // included for KERN_INFO
#include <linux/init.h>      // included for __init and __exit macros

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Lakshmanan");
MODULE_DESCRIPTION("A Simple Hello World module");

static int __init hello_init(void) {
  printk(KERN_INFO "Hello world!
");
  return 0;    // Non-zero return means that the module couldn't be
}

static void __exit hello_cleanup(void) {
    printk(KERN_INFO "Cleaning up module.
");
}   

module_init(hello_init); 
module_exit(hello_cleanup);

和生成文件":

obj-m += hello.o

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

我尝试了所有建议,并在终端中得到了这个:

I tried all suggestions and I got this in the terminal:

root@stupid-HP:/home/stupid/cpz/module$ pwd
/home/stupid/cpz/module
root@stupid-HP:/home/stupid/cpz/module$ ls
hello.c  Makefile
root@stupid-HP:/home/stupid/cpz/module$ make
make: Nothing to be done for `all'.
root@stupid-HP:/home/stupid/cpz/module$ make clean
make: Nothing to be done for `clean'.
root@stupid-HP:/home/stupid/cpz/module$ make clean all
make: Nothing to be done for `clean'.
make: Nothing to be done for `all'.
root@stupid-HP:/home/stupid/cpz/module$ ls
hello.c  Makefile
root@stupid-HP:/home/stupid/cpz/module$ make
make: Nothing to be done for `all'.
root@stupid-HP:/home/stupid/cpz/module$ vi hello.c  # modified again
root@stupid-HP:/home/stupid/cpz/module$ make clean
make: Nothing to be done for `clean'.
root@stupid-HP:/home/stupid/cpz/module$ make
make: Nothing to be done for `all'.

推荐答案

基于时间戳制作作品.如果您更改了某些源文件,请编译它们并相应地构建映像.如果您不更改源文件,那么编译器与您的项目无关.无论是否需要新构建,make 都不会像 gcc 那样每次编译.这是为您的项目使用 make 的众多优势之一.

Make works on the base of time stamps. If you alter some of your source files Make compile them and built the image accordingly. If you do not change source file then compiler has nothing to do with your project. make does not work like gcc to compile every time whether new build is needed or not. This is one of many advantages of using make for your project.

这篇关于为什么 make 打印是“make:无事可做‘所有’."?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆