为什么让印刷和QUOT;使:对于所有的`'做没什么&QUOT ;?。 [英] Why is make printing "make: Nothing to be done for `all'."?

查看:151
本文介绍了为什么让印刷和QUOT;使:对于所有的`'做没什么&QUOT ;?。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个HELLO.C模块和生成文件。执行后,制作来自沃金的目录,我得到了以下信息:


  

请:为做没有什么'所有'


这是HELLO.C文件:

 的#include< Linux的/  -  module.h中GT; //包含所有的内核模块
#包括LT&;的Linux / kernel.h> //包含了KERN_INFO
#包括LT&; Linux的/ init.h中> //包含了__init和__exit宏MODULE_LICENSE(GPL);
MODULE_AUTHOR(Lakshmanan);
MODULE_DESCRIPTION(一个简单的Hello World模块);静态INT __init hello_init(无效){
  printk的(KERN_INFO的Hello world \\ n!);
  返回0; //非回零意味着模块不能
}静态无效__exit hello_cleanup(无效){
    printk的(KERN_INFO清理模块\\ n);
}宏module_init(hello_init);
宏module_exit(hello_cleanup);

和生成文件:

  OBJ-M + = hello.o所有:
    使-C / lib / modules目录/ $(壳使用uname -r)/建造M = $(PWD)模块清洁:
    使-C / lib / modules目录/ $(壳使用uname -r)/建造M = $(PWD)清洁

我尝试了所有的建议和我得到这个终端:

 根@笨-HP:/家庭/笨/头孢哌酮/模块$ PWD
/家庭/笨/头孢哌酮/模块
根@笨-HP:/家庭/笨/头孢哌酮/模块$ LS
hello.c中的Makefile
根@笨-HP:/家庭/笨/头孢哌酮/模块$化妆
令:对于所有的`'必须做什么。
根@笨-HP:/家庭/笨/头孢哌酮/模块$使清洁
令:为'干净'做什么也没有。
根@笨-HP:/家庭/笨/头孢哌酮/模块$使清洁所有
令:为'干净'做什么也没有。
令:对于所有的`'必须做什么。
根@笨-HP:/家庭/笨/头孢哌酮/模块$ LS
hello.c中的Makefile
根@笨-HP:/家庭/笨/头孢哌酮/模块$化妆
令:对于所有的`'必须做什么。
根@笨-HP:/家庭/笨/头孢哌酮/模块$六的hello.c#再次修改
根@笨-HP:/家庭/笨/头孢哌酮/模块$使清洁
令:为'干净'做什么也没有。
根@笨-HP:/家庭/笨/头孢哌酮/模块$化妆
令:对于所有的`'必须做什么。


解决方案

请时间戳的基础上的作品。如果你改变你的一些源文件编译让他们建立相应的图像。如果你不改变源文件编译再有无关,与你的项目。让不喜欢 GCC 工作,每次编译是否需要或者不是新的编译时间。这是使用为您的项目的众多优势之一。

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

make: Nothing to be done for `all'.

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!\n");
  return 0;    // Non-zero return means that the module couldn't be
}

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

module_init(hello_init); 
module_exit(hello_cleanup);

And "Makefile":

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 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.

这篇关于为什么让印刷和QUOT;使:对于所有的`'做没什么&QUOT ;?。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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