Reputation: 3671
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?
Upvotes: 366
Views: 1058687
Reputation: 532
You can also install via the Scoop package manager (similar to Chololatey). Go to Scoop and search for the package you need. In this case make and paste the command for installing it.
Command to install make
on Windows. I tested in PowerShell.
scoop install main/make
Upvotes: 1
Reputation: 429
The procedure I followed is;
Upvotes: 2
Reputation: 11
For me installing ubuntu WSL on windows was the best option, that is the best tool for compiling makefile on windows. One thousand is better than Cygwin64, because to compile a makefile you will need another package and compile software like maybe gfortran, netcdf, etc, ect, in ubuntu WSL you can install all of these packages very easily and quickly ;)
Upvotes: 1
Reputation: 107
Go to http://gnuwin32.sourceforge.net/packages/make.htm and download make-3.81.exe, install and add to Windows path.
Upvotes: -1
Reputation: 111
If you have already installed the Windows GNU compiler (MinGW) from MSYS2 then make
command comes pre-installed as wingw32-make
. Always match cmake makefile generation with the correct make command. Mixing these generate problems.
MinGW makefile generation with MinGW make command
Visual Studio makefile generation with VS equivalent make command
And this is always possible as long as you have the source code. Just delete old build directory and start over by specifying this time the right parameter in cmake ,e.g.
mkdir build
cd build
cmake -G "MinGW MakeFiles" path/to/src/whereCMakeLists.txtInstructionsAre
mingw32-make
myProject.exe # RUN
I have encountered issues during compilation where multiple make commands interact. To prevent this just edit/remove the environmental variables that lead to different make commands. For example to prevent conflicts with mingw, keep only C:\msys64\mingw64\bin
but remove C:\msys64\usr\bin
. That other path contains the msys make and as I said you do not want to combine make commands during compilation.
Upvotes: 4
Reputation: 83
I tried all of the above. What helps me:
C:\MinGW\bin
to environment variables.mingw-get
into the command line.mingw-get install mingw32-make
.Done! Now You might be able to use make-commands from any folder that contains Makefile.
Upvotes: 8
Reputation: 2525
Install msys2 with make dependency add both to PATH variable. (The second option is GNU ToolChain for Windows. MinGW version has already mingw32-make included.)
Install Git Bash. Run mingw32-make from Git Bash.
Upvotes: 2
Reputation: 89
So if you're using Vscode and Mingw then you should first make sure that the bin
folder of the mingw
is included in the environment path and it is preferred to change the mingw32-make.exe
to make
to ease the task and then create a makefile
and include this code in it .
all:
gcc -o filename filename.c
./filename
Then save the makefile and open Vscode Code
terminal and write make
. Then makefile will get executed.
Upvotes: 1
Reputation: 2865
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.
Install the chocolatey package manager for Windows
compatible to Windows 7+ / Windows Server 2003+
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.
Upvotes: 259
Reputation: 6487
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
Upvotes: 82
Reputation: 41
I am assuming you added mingw32/bin
is added to environment variables else please add it and I am assuming it as gcc compiler and you have mingw installer.
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. Instead of renaming it you can directly run it as mingw32-make
.
After all, a command is just exe file or a software, we use its name to execute the software, we call it as command.
Upvotes: 0
Reputation: 740
I use MinGW tool set which provides mingw32-make
build tool, if you have it in your PATH
system variables, in Windows Command Prompt just go into the directory containing the files and type this command:
mingw32-make -f Makefile.win
and it's done.
Upvotes: 9
Reputation: 1809
Upvotes: 1
Reputation: 2834
If it is a "NMake Makefile", that is to say the syntax and command is compatible with NMake, it will work natively on Windows. Usually Makefile.win
(the .win
suffix) indicates it's a makefile compatible with Windows NMake. So you could try nmake -f Makefile.win
.
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. It also suggests a few alternatives to handling Linux Makefiles on Windows.
Upvotes: 4
Reputation: 31
I tried with cygwin & gnuwin, and didn't worked for me, I guess because the makefile used mainly specific linux code.
What it worked was use Ubuntu Bash for Windows 10. This is a Marvel if you come from MAC as it is my case:
Extras:
Hope it helps
Upvotes: 3
Reputation: 101
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
Upvotes: 10
Reputation: 1131
Here is my quick and temporary way to run a Makefile
C:\Program Files (x86)\GnuWin32\bin
libiconv2.dll libintl3.dll make.exe
make.exe
done.
Plus, you can add arguments after the command, such as
make.exe skel
Upvotes: 43
Reputation: 4698
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
Upvotes: 6
Reputation: 2701
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.
Upvotes: 3
Reputation: 185862
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.
Upvotes: 154