- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to use a makefile to build my project on Windows and a few question:
1. Does Visual Studio 2010 have an option to generate a makefile from an existing project?
2. Is the makefile format the same as on a UNIX machine? For example, can I use my old O'Reilly & Associates "Managing Projects with make" book for reference?
3. Can someone provide a example of a Intel Fortran makefile?
Thanks,
John
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A command line make utility (nmake) is provided with Visual Studio and other Microsoft development environments. The syntax of its input file has similarity with other make utilities, but beyond the basics you will find that differences in syntax and semantics appear.
Other make utilities are available, for example gnu make, that have strong unix heritage. You may find that they are a better match to the flavour of make described in your book.
A makefile for Intel Fortran could potentially be trivial, depending on what you want to do, though one complication with modern Fortran code is the handling of modules and the associated .mod file that compilers may generate.
(Why do you want to switch to a makefile? Is this because you are going cross platform? If so, then cross platform solutions other than makefiles exist, that I personally find to be superior. Is it because you want to compile projects from the command line? If so, there is a command line interface to the Visual Studio build engine. Or is it because you prefer your build system to use an archaic and error prone input file format which is sensitive to things like the particular "invisible" whitespace character your text editor puts at the start of a line? If so, then you are on the right path...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are freely downloadable Perl, Bash and other scripts (search for "makemake", "makedepend90", etc.) that will scan all the Fortran source files in a given directory for MODULE and USE declarations and build a makefile for you. They work well except in one regard: if you make a change in the routines in a module without altering their interfaces, the Make system will not know that source files that USE that module need not be recompiled. Another minor problem on Windows is that the Intel compiler cannot be told to change the suffixes of groups of object files to .o instead of .obj , although the /Fo option lets you designate individual object files with any desired name or suffix.
Other than the issue just mentioned, Make works fine with large Fortran projects (e.g., Galahad2 for optimization). You can even make use of 'touch' manually to prevent "compilation cascades".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the replies. I am looking for a cross-platform solution for both Linux and Windows but am limited to only using Intel Fortran with Visual Studio 2010. We manage large legacy source codes that require difference compiler options for certain individual source files. A makefile is nice because in one small file you can see all the compiler options and any special compile requirements in an ASCII format that will be viewable forever. In Visual Studio, it does not appear you can easily identify projects that contain individual source files requiring different compiler options than the main project. Does Visual Studio 2010 have a command line environment that would provide something similar to a makefile in terms of seeing all the compiler options for the entire project?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(You can open the vfproj for your project in a text editor - it is just an xml file. When examining that file it is reasonably obvious when particular files have customised settings, though not necessarily what those customisations mean in terms of command line options.)
If you are familiar with make then perhaps that is appropriate, but if not then before committing to one or other have a look at some of the other cross platform tools out there. cmake is one that I've used on occasion.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page