Intel® Fortran Compiler XE 13.1 User and Reference Guides

Using Makefiles to Compile Your Application

You can use makefiles to specify a number of files with various paths and to save this information for multiple compilations.

Linux* OS and OS X*:

To use a makefile to compile your input files, make sure that /usr/bin and /usr/local/bin are in your PATH environment variable.

If you use the C shell, you can edit your .cshrc file and add the following:

setenv PATH  /usr/bin:/usr/local/bin:$PATH

Then you can compile as:

make -f yourmakefile

where -f is the make command option to specify a particular makefile.

Generating Build Dependencies for Use in a Makefile

Use the -gen-dep (Linux* OS and OS X*) compiler option to generate build dependencies for a compilation. Build dependencies include a list of all files included with INCLUDE statements and .mod files accessed with USE statements. The resulting output can be used to create a makefile to with the appropriate dependencies resolved.

Consider a source file that contains the following:

 module b
 include 'gendep001b.inc'
 end module b

 program gendep001
 use b
 a_global = b_global
end

When you compile the source using the /gen-dep or -gen-dep option, the following output is produced:

 b.mod : \
 gendep001.f90
gendep001.obj : \
 gendep001.f90 gendep001b.inc

This output indicates that the generated file b.mod depends on the source file gendep001.f90. Similarly, the generated file gendep001.obj depends on the files gendpe001.f90 and gendep001b.inc.


Submit feedback on this help topic