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

output folder option for linux

tcdan
Beginner
1,540 Views

Just found this forum - looks great!

In Windows, if I want to compile several fortran files at once and send them to a different folder, I do so by specifying /FoOutputDir.

I do not see an option for this in Linux. Is it impossible to specify an output directory in Linux? Is there some workaround so I can still pass several files to the compiler at once and write the *.o files in a separate directory?

0 Kudos
2 Replies
Kevin_D_Intel
Employee
1,540 Views

There is no /Fo equivalent in Linux but you can use the -o option with a sub-directory specified.

For example:

ifort -c -o /file.o file.f90

Where is an absolute or relative directory path. With -c this places the resulting named file.o into the directory specified.

If your program uses modules, you can place those using -module similar to the /Fo.

0 Kudos
Kevin_D_Intel
Employee
1,540 Views

Another possible solution is to 'cd' into the object file destination sub-directory and then use a relative or absolute path to the source files. You would not need the -o option in this case.

To compile all *.f90 source files, use something like: ifort -c /*.f90

The -o option is convenient for makefiles.

0 Kudos
Reply