Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Using a Makefile

chauvjo
Novice
1,913 Views

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

0 Kudos
4 Replies
IanH
Honored Contributor III
1,913 Views
Visual Studio 2010 and other recent versions no longer have inbuilt capability of generating makefiles from projects and solutions.

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...)
0 Kudos
mecej4
Honored Contributor III
1,913 Views
I have been using GNU make (on Windows-Cygwin, Linux and Solaris) with Intel and other Fortran compilers for a number of years. As IanH pointed out, with Fortran-9X modules you run into some situations that the creators of Make and its paradigms did not foresee in the late 1970s. GNU make works the same on many platforms, including Windows.

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".
0 Kudos
chauvjo
Novice
1,913 Views

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?

0 Kudos
IanH
Honored Contributor III
1,913 Views
Well, you're certainly not going to find Visual Studio on linux, and consequently you're not going to find Intel Fortran's integration into Visual Studio on linux. So yes - from a cross platform point of view you will need to look at something else.

(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.
0 Kudos
Reply