Why is make printing "make: Nothing to be done for `all'."?

69,275

Solution 1

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.

Solution 2

  1. make clean and then make again
  2. check for spaces and tabs as per make file format
  3. Verify the Path of the kernel libraries

Solution 3

You should remove space in your Makefile. In makefile, only use tab.

I tested your code again, and it works with tab

Solution 4

Compiler is simply telling you that your code was already compiled and there are no changes in your code (it is up to date), then it does not compile. Is a builtin feature of compilers, if there are no changes in source code file, compilers do not waste time.

Use make clean before to make or modify Hello.c and Build your project.

Solution 5

Try : make clean to delete the executable file (./a.out) and try to compile it again! You may have something change in some fuction and make can't see it

Share:
69,275
user55111
Author by

user55111

Updated on June 29, 2020

Comments

  • user55111
    user55111 almost 4 years

    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'.
    
  • user55111
    user55111 over 8 years
    i typed both cmd , i edited question so you can check response. i'm using Ubuntu 14.04. i wriiten hello.c and makefile in current working dir and I am trying to add this module to kernel. am i missing any step?
  • Dr.jacky
    Dr.jacky over 7 years
    How to force compile to compile? ignore changes check
  • incompetent
    incompetent over 7 years
    I do not know such method but you can use touch to change time stamp or make clean and then make again
  • Curnelious
    Curnelious about 7 years
    God, clean made it for me ! why I have to clean at all ?
  • Dilip Kumar
    Dilip Kumar about 7 years
    @Curnelious clean is something you remove any previous build to make sure you get a clean build and don't have any old files from previous build.
  • Rγσ ξηg Lιαη Ημ
    Rγσ ξηg Lιαη Ημ over 2 years
    make clean clean all non-folder files, doesn't work on my Ubuntu 20.04LTS
  • LPs
    LPs over 2 years
    I t depends on your makefile. Does it define a clean rule?