Skip to main content

Run Make on Windows

This guide explains how to install GNU Make on Windows using the GnuWin32 package. This method is useful if you prefer not to use package managers like Chocolatey or Scoop, or if they are not available in your environment.

1. Download and Install Make from GnuWin32

  • Navigate to the GnuWin32 page for Make.
  • Download the setup program (e.g., make-3.81-setup.exe or the latest version available).
  • Run the downloaded installer and follow the on-screen prompts. The default installation directory is typically C:\Program Files (x86)\GnuWin32. Make a note of this path for the next step.

2. Add Make to the System PATH

To run make from any directory in PowerShell or Command Prompt, you need to add its installation directory to your system's PATH environment variable.

  • In the Windows search bar, type "environment variables" and select "Edit the system environment variables."
  • In the System Properties window that opens, click the "Environment Variables..." button.
  • In the Environment Variables window, under the "System variables" section, find and select the variable named Path.
  • Click the "Edit..." button.
  • Click "New" and add the path to the bin directory of your GnuWin32 installation. If you used the default installation path, this will be C:\Program Files (x86)\GnuWin32\bin.
  • Click "OK" on all open dialog windows to save the changes.

img

3. Verify the Installation

  • Open a new PowerShell or Command Prompt window. (Changes to environment variables only take effect in new terminal sessions).
  • Type the following command and press Enter:
    make --version
  • You should see output displaying the GNU Make version, similar to:
    GNU Make 3.81
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.

4. Makefile Considerations (Optional)

Some Makefiles, especially those written for Unix-like systems, might use $(shell pwd) to determine the current directory. The pwd command may not be available by default on Windows, which can cause errors.

The standard and portable Make variable for getting the current directory is $(CURDIR). If you encounter a Makefile that uses BASE_DIR := $(shell pwd) or similar, it's best to change it to BASE_DIR := $(CURDIR) for better cross-platform compatibility.