tags:

views:

234

answers:

9

hi,

I am in a big problem ..i have compiled my c files using linux make file in Linux OS.

I want to compile the same files in Windows using the same make file by command prompt. For that i have nmake utility and Cygwin utility too.

I have done that successfully with simple programs with simple make file ..

But it is not possible to compile when i was using the complex C files with complex make file.

I have changed the '/' in linux make file to '\' in windows? Anyother changes?

I want to know 'Is there any special make file formats in windows?'

also the difference between them..

I am really in need of that...

Renjith G

A: 

nmake should read your makefiles okay, the differences are generally between versions of make rather than OSs.

The big question is what your target platform actually is, are you trying to make this code operate in Windows natively or are you looking to run it under Cygwin?

Lazarus
Thanks..I am using NMAKE.EXE 1.50 ...I thinks thats the problm.Also I have given the path set PATH=C:\cygwin\bin;%PATH% in command prompt. I want to know the Is there any format /syntax diff between them?
Renjith G
I don't know nmake well enough so check with one of the guys below. I'd suggest that you remove the accepted answer from this one and apply it to one of those below, if that's possible. They certainly deserve the accept more than I do.
Lazarus
A: 

Use gnumake on both platforms. I do. I haven't touched Visual C in years.

Blank Xavier
+1  A: 

You should consider CMake for cross-platform make but your real problem is you shouldn't have to change the '/' to '\'. If you run under cygwin or msys (recommended) this should be handled for you.

SpliFF
Not to mention that Windows interprets forward-slashes as directory separators just as well as backward-slashes, so (unless a poorly-behaving program screws up its own path parsing) "command C:/some/thing" works the same as "command C:\some\thing".
ephemient
+1  A: 

NMake is a windows tool and will parse only windows-style paths, i.e. paths with drive letters and backslashes. Therefore you should use GNU Make installed with cygwin.

A: 

dmake might help: http://tools.openoffice.org/dmake/index.html

Sinan Ünür
A: 

Check out this question which can help you

Manual for cross compile a c application from linux to windows
and this link LinuxCrossMinGW

Boris Guéry
A: 

nmake got it's own format rather than windows itself, so makefile format is related to make tool rather than os. For simple things format is similar for g(nu)make and nmake, as people suggested before consider using gmake only.

Joakim Elofsson
thanks ...both hav same format?
Renjith G
only for the very basic things
Joakim Elofsson
+3  A: 

Unfortunately, nmake was only loosly inspired by make, and they didn't get many important things right. By far the easiest thing to do is to start by having the same flavor of make on both platforms.

On linux, Gnu make is the default and best option.

On Windows, there are several sources for Gnu make, with some quirks to choose among. Personally, I mostly use the native win32 build of Gnu make from the GnuWin32 project. You might want to poke around at the rest of the project's packages because some of the others will be useful to have as well.

Alternative sources are Cygwin and MinGW32/MSYS.

Cygwin is a credible attempt at providing a *nix compatibility environment on top of the Windows kernel. It consists of a DLL that exports a huge percentage of *nix (especially POSIX) system calls implemented via the Windows API. That DLL also has its own idea about disk mounts and prefers *nix-style path names. The DLL itself is licensed GPL (although a commercial-use license is available for a fee), and programs built in the Cygwin environment require it by default, so that can be a factor to consider. Another factor is that Cygwin is not friendly to normal Windows users, so development projects based on it usually end up difficult for non-unix users to deal with. For a cross-platform developer, however, Cygwin can be really useful as it gets you all of the usual suspect utility programs required by your Makefile, and it includes the MinGW32 native Windows targeted GCC as well as a GCC targeting the Cygwin environment.

MinGW32 is a porting project that did a really good job of porting the GCC compilers to run as native Windows executables. If used along with the header files they supply, it is possible to use nearly all of the Windows API via a C runtime DLL that ships with modern Windows installations.

MSYS is a lightweight fork of Cygwin that contains a minimal set of utilities (starting with a *nix shell) that are usually assumed to exist by a typical *nix Makefile. Unlike Cygwin, MSYS is configured such that the default target is the native Windows API.

What I'm trying to hint at here, and probably should just state flat out, is that your compatibility issues don't end with the dialect of make you use.

The Makefile language itself is highly dependent on the command shell available, and most serious project Makefiles end up using many of the *nix the core utilities such as cp and rm.

I would strongly recommend starting with the GnuWin32 build of make, and also installing MinGW32 and MSYS. It is then relatively easy to write a Makefile that works under both MSYS and linux, and needs only a small amount of platform-specific logic.

RBerteig
A: 

very bad questions .....