GNU Makefile - What needs to be done to go from Linux to make it run on Windows?

I have a GNU Makefile that already exists for a Linux C program.  What types of things need to be done to make the Makefile work on a Windows machine?
VWrestle97Asked:
Who is Participating?
 
VWrestle97Connect With a Mentor Author Commented:
I ended up using Cygwin after-all because I found a command for windows batch file that can be used to send a series of commands to Cygwin with just requiring one instance of Cygwin open.  

The command I used in batch to access Cygwin is:

bash --login -c "command_1; command_2; ... command_N; exit; exec bash -rcfile exit"

I was misinformed from another thread that what I wanted to do cannot be accomplished with Cygwin, but when I figured it out I decided to use Cygwin instead of making my own version of windows makefile from a Linux makefile.
0
 
yjwongCommented:
If your program is portable to Cygwin, then it will work seamlessly. Try compiling your program using the standard Make utilities in the Cygwin suite.
0
 
VWrestle97Author Commented:
I don't think this is an option for me as posted in a recent question titled, "Using Windows Command Prompt, How to run a series of Cygwin statements immediately after Cygwin Starts"  where I stated, "I have Cygwin installed on my Windows XP.  I would like -  from windows command prompt -  to be able to open up Cygwin immediatley followed by a series of commands.  What is the best way to approach this?  Please provide example syntax."

An answer provided to this question was, "The only other way to pass on another command from the same batch file is to add a syntax to BASH.EXE; however I could not find anything for running another batch file. The only syntaxes are for logging in and setting the home directory. I don't think what you are asking is possible to do from one batch file."

Does this sound correct to you?  If that is true, then I can't use Cygwin because I am trying to get Matlab to run a series of Linux commands, so I believe the only solution that I have is to create a windows .bat version for the C program.  Do you agree with this?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
yjwongCommented:
I'm not sure if that's what you wanted, but here's just a possible solution. You could actually directly run the Cygwin executables (i.e. make) without starting BASH by adding the Cygwin bin directory into your %PATH% environment variable. That way, you are able to run the make utilities directly through the Windows command prompt, or through the batch file.
0
 
VWrestle97Author Commented:
Ah... this wasn't exactly my question, and I was able to do this but not the way you describe.  I don't have the example on me right now, but I will post it here when I get access to it so you can see how I did it.  I am not sure of the way you explain it, but can you explain in more detail about how to do it your way?

Getting back to my original question; I don't want to use Cygwin.  Basically I want to know the differences between the linux and windows makefile and what type of changes need to be made to make it compatible with windows.  Sorry for the confusion.

0
 
yjwongCommented:
What I did was just setting the PATH variable in the batch file to include the Cygwin's bin directory. For example, if your Cygwin bin directory is in C:\Cygwin\bin, then the batch file would look something like:

set PATH=%PATH%;C\Cygwin\bin
cd source_directory
make <some target>

If you are going to use the Windows makefile syntax, then I can't really help. I don't really know the differences between nmake and make. Sorry if I can't help.
0
 
VWrestle97Author Commented:
I'm sorry, the I used Matlab to setup my path - path('C:\blah\blah',path);  

so nmake is the windows version of linux's make?
0
 
VWrestle97Author Commented:
I ended up using Cygwin after-all because I found a command for windows batch file that can be used to send a series of commands to Cygwin with just requiring one instance of Cygwin open.  

The command I used in batch to access Cygwin is:

bash --login -c "command_1; command_2; ... command_N; exit; exec bash -rcfile exit"

I was misinformed from another thread that what I wanted to do cannot be accomplished with Cygwin, but when I figured it out I decided to use Cygwin instead of making my own version of windows makefile from a Linux makefile.
0
 
Vee_ModCommented:
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0
All Courses

From novice to tech pro — start learning today.