compiler option to produce fortran .mod files

Is there a compiler option to produce only the .mod module file?

I am attempting to create a makefile that properly handles dependencies on module files (using as a guide appendix D from Metcalf, Reid, and Cohen’s book on Fortran95/2003).

I believe other compilers may use an option such as ‘-M’ for this…

Hi rmpalmer,’

Is there a compiler option to produce only the .mod module file?

No. You’ll need to either use “-c” which says to compile only (create an object file but don’t link), or “-S” which stops stops just before the assembly step.

I believe other compilers may use an option such as ‘-M’ for this…

-M, -MM, and -MD are C preprocessor flags used to generate dependency lists for Makefiles. For the Fortran compiler, the flag “-Mcpp=m” would be the equivalent. However, for Fortran module dependencies, I’ve either written my own scripts or used utilities like makedepf90 ( http://personal.inet.fi/private/erikedelmann/makedepf90/).

  • Mat