Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29071 Discussions

Compile multiple files from command line

brunocalado
Beginner
657 Views
Hi.
I'm using the following command
[bash]ifort -recursive -O3 -zero -axSSE2 -xSSE2 -o FORGATRAN genes/binaryGene.f90 src/general.f90 src/converge.f90 src/main.f90 src/statistics.f90 src/randomga.f90 src/replacement.f90 src/encode.f90 src/selectors.f90 src/parameters.f90 src/sorter.f90 src/cross.f90 src/score.f90
[/bash]
I have to repeat this about three times to get my bin. How can I do it one single time?
Thank you.
0 Kudos
3 Replies
mecej4
Honored Contributor III
657 Views
Presumably, the first two compilations abort without compiling all the source files.

Do the files contain modules? If so, and you know which module depends on which other modules, you can list the source files in proper order (dependents listed later) in the command line.

You can also use a makefile.
0 Kudos
brunocalado
Beginner
657 Views
More than two.
Yes it contains modules. Yes, I know but is a little messy. A depends from B which needs C which needs A.
Find the right way for the source files is not a good solution for me.
Use a makefile is a solution but I think may have another easy way with some compiler option.
0 Kudos
mecej4
Honored Contributor III
657 Views
I don't understand what you mean by "A depends from B", but the Fortran 2003 standard is quite clear about circular dependencies.

Section 11.2.1 says:

A module shall not reference itself, either directly or indirectly.

Therefore, if A depends on B, B on C and C on A, you have a program that contains a module that depends on itself indirectly. Even if the standard allowed such a program, it could be next to impossible for a compiler to process such a program.
0 Kudos
Reply