How to run a makefile in Windows?


Translate

I have some demos that I downloaded and they come with a Makefile.win and a Makefile.sgi. How can I run these in Windows to compile the demos?


All Answers
  • Translate

    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.


  • Translate

    Check out cygwin, a Unix alike environment for Windows


  • Translate

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


  • Translate

    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


  • Translate

    With Visual Studio 2017 I had to add this folder to my Windows 10 path env variable:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
    

    There's also HostX86


  • Translate

    Firstly, add path of visual studio common tools (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools) into the system path. To learn how to add a path into system path, please check this website: http://www.computerhope.com/issues/ch000549.htm. You just need to this once.

    After that, whenever you need, open a command line and execute vsvars32.bat to add all required visual studio tools' paths into the system path.

    Then, you can call nmake -f makefile.mak

    PS: Path of visual studio common tools might be different in your system. Please change it accordingly.


  • Translate

    If it is a "NMake Makefile", that is to say the syntax is compatible with NMake, it will work.

    Often standard Linux Makefiles are provided and NMake looks promising. However, the following link takes a simple Linux Makefile and explains some fundamental issues that one may encounter.

    Makefiles in Windows


  • Translate

    If you install Cygwin. Make sure to select make in the installer. You can then run the following command provided you have a Makefile.

    make -f Makefile
    
    https://cygwin.com/install.html
    

  • Translate

    This question may be an old one but my solution, which is by far the simplest for any windows user I daresay, is not listed.

    Step 1: Install the chocolatey package manager for WINDOWS (compatible to Windows 7+ / Windows Server 2003+) here

    Step 2: run choco install make

    Step 3: Profit from a well-maintained package manager. Make will have been added to the global path and runs on all CLIs (powershell, git bash, cmd …)

    I am not affiliated with choco but is JUST THAT GOOD.


  • Translate

    Maybe you can try NetBeans IDE.