gfortran: как управлять выходным каталогом для файлов .mod - PullRequest
4 голосов
/ 28 января 2009

Есть ли способ поместить файлы .mod, сгенерированные gfortran (GCC), в отдельный выходной каталог? Я знаю, как разместить объектные файлы или другой вывод с флагом -o, как в:

gfortran -c test.f03 -o /path/to/output/dir/test.o

Но на файлы .mod (которые генерируются вышеуказанным вызовом) флаг -o не влияет и помещается в текущий каталог. Некоторые коммерческие компиляторы имеют флаг типа -qmoddir, но я не могу найти что-то похожее для gfortran.

Если такого флага нет, возможно ли сгенерировать файлы .mod на дополнительном шаге, чтобы флаг -o заработал?

Ответы [ 2 ]

11 голосов
/ 22 февраля 2009

В документации GNU gfortran указано, что -M dir или его синоним -J dir указывает выходной каталог для .mod файлов.

0 голосов
/ 16 марта 2019

Согласно официальной документации (-Mdir дал gfortran: error: unrecognized command line option ‘-Mobj’):

-Idir
  These affect interpretation of the INCLUDE directive (as well as of the #include directive of the cpp preprocessor).

  Also note that the general behavior of -I and INCLUDE is pretty much the same as of -I with #include in the cpp preprocessor, with regard to looking for header.gcc files and other such things.

  This path is also used to search for .mod files when previously compiled modules are required by a USE statement.

  See Options for Directory Search in Using the GNU Compiler Collection (GCC), for information on the -I option.

-Jdir
  This option specifies where to put .mod files for compiled modules. It is also added to the list of directories to searched by an USE statement.

  The default is the current directory.

-fintrinsic-modules-path dir
  This option specifies the location of pre-compiled intrinsic modules, if they are not in the default location expected by the compiler.
...