Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a makefile in Windows?

People also ask

Can you run makefile in Windows?

Since Make is not directly available in Windows, we need to install the package manager first. Then, we will use this package manager to install the make tool.

How do I call a makefile in Windows?

First step: download mingw32-make.exe from mingw installer, or please check mingw/bin folder first whether mingw32-make.exe exists or not, else than install it, rename it to make.exe . After renaming it to make.exe , just go and run this command in the directory where makefile is located.

How do I run a makefile in Windows Visual Studio?

From the Visual Studio start page, type "makefile" in the New Project search box. Or, in the New Project dialog box, expand Visual C++ > General (Visual Studio 2015) or Other (Visual Studio 2017) and then select Makefile Project in the Templates pane to open the project wizard.

How do I run a makefile in Windows using MinGW?

Generates makefiles for use with mingw32-make under a Windows command prompt. Use this generator under a Windows command prompt with MinGW (Minimalist GNU for Windows) in the PATH and using mingw32-make as the build tool. The generated makefiles use cmd.exe as the shell to launch build rules.


If you have Visual Studio, run the Visual Studio Command prompt from the Start menu, change to the directory containing Makefile.win and type this:

nmake -f Makefile.win

You can also use the normal command prompt and run vsvars32.bat (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools for VS2008). This will set up the environment to run nmake and find the compiler tools.


You can install GNU make with chocolatey, a well-maintained package manager, which will add make to the global path and runs on all CLIs (powershell, git bash, cmd, etc…) saving you a ton of time in both maintenance and initial setup to get make running.

  1. Install the chocolatey package manager for Windows
    compatible to Windows 7+ / Windows Server 2003+

  2. Run choco install make

I am not affiliated with choco, but I highly recommend it, so far it has never let me down and I do have a talent for breaking software unintentionally.


Check out cygwin, a Unix alike environment for Windows


Check out GnuWin's make (for windows), which provides a native port for Windows (without requiring a full runtime environment like Cygwin)

If you have winget, you can install via the CLI like this:

winget install GnuWin32.Make

Also, be sure to add the install path to your system PATH:

C:\Program Files (x86)\GnuWin32\bin

Here is my quick and temporary way to run a Makefile

  • download make from SourceForge: gnuwin32
  • install it
  • go to the install folder

C:\Program Files (x86)\GnuWin32\bin

  • copy the all files in the bin to the folder that contains Makefile

libiconv2.dll libintl3.dll make.exe

  • open the cmd (you can do it with right click with shift) in the folder that contains Makefile and run

make.exe

done.

Plus, you can add arguments after the command, such as

make.exe skel