make: Nothing to be done for `default’

Most programs build with a simple, two-command sequence:

$ ./configure
$ make

The configure program is a shell script that is supplied with the source tree. Its job is to analyze the build environment. configure command creates several new files in our source directory. The most important one is Makefile. Makefile is a configuration file that instructs the make program exactly how to build the program. The make program takes as input a make file (which is normally named Makefile), which describes the relationships and dependencies among the components that compose the finished program.

While writing make files to compile kernel modules we might come across the error:

make: Nothing to be done for 'default'.

The common cause for the error is the lack of tab space before the command. A make rule always has three parts a target, a prerequisite, and the command to generate the target from the prerequisite.

target:prerequisite
       command

For make to be able to differentiate between a command and a target, the command always needs to be prefixed with one tab space. In case we fail to do so then make will not recognize it as a command and throw an error saying that there is no command specified for the target. It is the same error as given above where default is the target.

Thus to solve the problem just open the makefile and add a tab space before the command for whichever target the error is being thrown.

Final Note

./configure, make, make install — can be used to build many source code packages. We have also seen the important role that makes plays in the maintenance of programs. The make program can be used for any task that needs to maintain a target/dependency relationship, not just for compiling source code. We have seen how to resolve the “Nothing to be done for ‘default'” error while running the make program.

Related Post