How to Fix ‘make: *** No targets specified and no makefile found. Stop.’ in Linux

Compiling software from source code in Linux using the GNU make utility is a fundamental system administration and development skill. However, running the make command inside a newly extracted project archive or cloned Git repository can immediately terminate with a terminal error: make: *** No targets specified and no makefile found. Stop. This error signifies that GNU Make scanned your current working directory for build instruction files—such as Makefile or makefile—and found none, leaving the utility with zero compilation directives.

Why Does make Report ‘No Makefile Found’?

GNU Make does not generate software builds on its own; it requires a structured configuration file called a Makefile that defines build targets, compiler flags, and source dependencies. The error arises due to:

  • Missing Pre-Compilation Configuration Step: Attempting to run make before executing ./configure or generating the build configuration file.
  • Modern CMake or Meson Build Systems: The project relying on modern build meta-generators (such as CMake, Meson, or QMake) that do not store pre-built Makefiles in the root source tree.
  • Incorrect Current Working Directory: Executing make in a parent directory or subfolder that does not contain the actual project build file.
  • Case-Sensitivity and Custom Makefile Naming: The Makefile being named using non-standard naming conventions (such as Makefile.in, Makefile.am, or build.mk) that GNU Make does not parse automatically without specific flags.
  • Unextracted or Incomplete Project Repositories: Submodules missing from a freshly cloned Git repository.

Step 1: Check Current Directory and Inspect Existing Build Files

Verify whether a Makefile exists or if an alternate build configuration script is present.

  1. Confirm your current path:
    pwd
  2. List all files in the directory, checking for build scripts:
    ls -la
  3. Look for files such as configure, CMakeLists.txt, meson.build, Makefile.in, or autogen.sh.
  4. If no build files exist, ensure you have navigated (cd) into the specific unpacked source directory where the codebase resides.

Step 2: Generate the Makefile via ./configure

In standard GNU Autotools projects, the Makefile is dynamically generated based on your system’s hardware architecture and installed development libraries.

  1. If a file named configure is present in the directory, run it first:
    ./configure
  2. The configure script checks for required compilers (such as gcc, g++) and dependencies, then automatically outputs a verified Makefile in the directory.
  3. Once the script prints config.status: creating Makefile, run:
    make
  4. Compilation will commence without throwing target errors.

Step 3: Generate the Makefile Using CMake

Projects utilizing CMake must generate Makefiles through CMake’s configuration pass.

  1. If you observe a file named CMakeLists.txt, install CMake:
    sudo apt install -y cmake build-essential
  2. Create a clean out-of-source build directory:
    mkdir -p build && cd build
  3. Instruct CMake to generate native Makefiles:
    cmake ..
  4. CMake will inspect dependencies and generate a complete, optimized Makefile inside the build/ directory.
  5. Now invoke make:
    make -j$(nproc)
    (The -j$(nproc) flag compiles across all available CPU cores for maximum speed).

Step 4: Specify Custom Makefile Names with the -f Flag

If the developer used an explicit or alternate filename for the build directives, point GNU Make directly to it.

  1. If your directory contains files named Makefile.linux, Makefile.unix, or GNUmakefile:
  2. Pass the -f flag followed by the exact filename:
    make -f Makefile.linux
  3. This overrides default filename lookups and reads the build rules immediately.

Step 5: Clone Git Submodules for Complex Repositories

If the source code was cloned from GitHub, third-party build components may reside in unpopulated submodules.

  1. In the root of the Git repository, pull all required submodule trees:
    git submodule update --init --recursive
  2. Once submodules populate, review the project’s README.md to follow the developer’s exact build pipeline.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.