We have a fairly complicated piece of software with thousands of files, multiple libraries/executables/build configurations (many implemented with #ifdef blocks), and a mixture of F77/F90/F2003 code (some of it 20+ years old) with hundreds of common blocks and dozens of modules. I'm trying to improve our build system on Linux. I'm using Intel Composer XE 2013 (we may be switching to 2016 soon) and GNU Make from GCC 4.4.7. I've run into a few problem that I'll list below.
1) We have a build order generator written in perl that deals with the module dependencies, but I'd like to use the ifort dependency generation to determine the build order. If I run, for example, "ifort -P -gen-dep=file.d file.F90" (along with all of our include paths, preprocessor definitions, etc.) It does generate dependency files with rules for objects, includes, etc. but it doesn't create rules for *.mod file dependencies (even if I use the -module option). If I don't use the -P option, it does generate the *.mod make rules, but usually bombs during compilation because it can't find *.mod. Is there a way to generate module dependency rules with ifort without actually compiling?
2) When generating dependency Make rules for #include files and *.mod files, the targets of the rules do not have absolute paths, which breaks Make's dependency trees. Example:
! file "BLOCK.CMN" INTEGER i COMMON / CBLOCK / i ! file file.F90 MODULE MOD_A IMPLICIT NONE INTEGER a CONTAINS SUBROUTINE set(aIN,iIN) #include "BLOCK.CMN" INTEGER, INTENT(IN) :: aIN, iIN a = aIN i = iIN END SUBROUTINE set END MODULE MOD_A
If the previous file is compiled with the command...
ifort -c -I/path/to/includes -module /path/to/mod/files -gen-dep -o /path/to/objects/file.o /path/to/source/file.F90
... it generates the following Make rules...
file.o : /path/to/includes/BLOCK.CMN mod_a.mod: /path/to/source/file.F90 /path/to/objects/file.o : /path/to/source/file.F90
... instead of ...
/path/to/objects/file.o : /path/to/includes/BLOCK.CMN /path/to/mod/files/file.mod : /path/to/source/file.F90 /path/to/objects/file.o : /path/to/source/file.F90
If I understand it correctly, Make won't resolve the fact that "/path/to/objects/file.o" is the same as "file.o". The problem this causes is that you can modify "BLOCK.CMN" and nothing will get rebuilt.
I can probably provide an full working example if needed. Thanks!