Make: *** No Targets Specified And No Makefile Found. Stop.

The error message “make: *** No targets provided and no makefile found” may appear while you’re working with Ubuntu, Debian, or Red Hat. Stop. Because this is a general problem with GNU Make, you may see it on any number of Unix systems. A makefile or Makefile does not exist in the current working directory. Fortunately, it’s a simple mistake to correct.

Make: *** No Targets Specified And No Makefile Found. Stop.

Method 1: A Makefile in the Current Directory Can Be Found Using

It’s possible that you’ll get the same problem if you run make one more time in the current directory. Since your last attempt at running GNU make, you’ve probably opened another terminal session and tried to locate its proper directory, or you’ve used cd.

You may examine what files are in your current directory by running the ls or dir command. Your location in the directory tree may be incorrect. A quick cd command can help ensure that you run make in the correct location if you see directories that should be in your home or root / directory.

Even if you’re anticipated to be in a specific location, you may find yourself in a different location. Make failed miserably when attempted from the /var/crash directory in our case. The only files in this exact area are from unrelated crash reports, therefore it can’t be expected to execute from there.

Your make command should be executed from a directory somewhere in your home directory, assuming that you haven’t already done so. It’s possible to cd to a directory like /nano-2.9.6 and execute make again, for example, if you’re building the newest version of GNU nano from source. Make sure there is a makefile in the directory before trying to make it.

Remember that you must first configure the installation before you can proceed. The GNU compiler thrives in the ideal environment provided by the configure command. ./configure and the make command can help if you can’t find a makefile, even though you’ve checked in the correct project directory. Install your project with sudo make install if this compiles well, but remember that you don’t want to build anything as root, so you’ll never want to do sudo make or anything else outside of installation.

Method 2: A Custom Makefile can be Specified

No further action is required if the problem has been resolved. However, if the prior solution didn’t solve your problem, there are two unique scenarios to consider. Writing your own makefile for a project that you’ve been configuring by hand is required for both of these examples.

Using the -f option, you can designate a makefile with a different name than makefile. It is possible to use the command line to specify a backup file, such as makefile.bak, if you have one. There is no need to use makefile.bak if you don’t wish to ignore mistakes in a custom or old makefile throughout the compilation process. This is generally discouraged, as you’ll likely need to make changes to your makefile if there is a problem with it.

Case sensitivity is another use case that is very closely related to this one. In Unix, each of the following is a separate file:

  • Makefile
  • makefile
  • makeFile
  • MakeFile
  • MakefilE

Packages that have been customised may not be able to read a makefile that uses standard capitalization. Using the -i option, you may ensure that GNU make is able to locate the makefile even if it was handwritten for a coding mission you’re working on. Take into account the fact that even though your code is complete, you can still run./configure from your own job to ensure that your environment is set up correctly and avoid this issue.