Recently, I need to compile multiple fortran programs in Linux and search for them online, but there is not much information. Maybe this problem is simple and not worth mentioning, but I still write what I know for your reference:
Method 1:
Assume there are two fortran programs, fun. f90 and Main. f90, where main. f90 is the main program, fun. f90 is a subroutine called in the main program. Put these two files in a directory and use the Fortran compiling command, such as Intel's ifort. The command is as follows:
Ifort-O exe_name fun. f90 main. f90
Or ifort-O exe_name main. f90 fun. f90
Method 2:
Add the include 'fun. f90' statement to the main program main. f90 and compile it with the Fortran command in Linux. The command is as follows:
Ifort-O exe_name main. f90
Method 3:
The command for step-by-step compilation is as follows:
Ifort-C main. f90 (after executing this command, a main. o file will be generated in the directory)
Ifort-C fun. f90 (after executing this command, a fun. o file will be generated in the directory)
Ifort-O exe_name fun. O main. O or ifort-O exe_name main. O fun. o
From: http://www.cnblogs.com/liyanwei/archive/2010/04/29/1723893.html
Compile multiple files in FORTRAN (reproduced)