MPAS-Dev / MPAS

Repository for private MPAS development prior to the MPAS v6.0 release.
Other
4 stars 0 forks source link

Makefile rule $(RM) $@ $*.mod causes unnecessary compilations #1280

Open matthewhoffman opened 7 years ago

matthewhoffman commented 7 years ago

MPAS Makefiles include this line:

.F.o:
        $(RM) $@ $*.mod

which causes the *.o and *.mod files to be deleted before they are compiled. This forces every source file in a directory to be re-compiled at each invocation of make, leading to a lot of unnecessary compilation in some situations. I believe this is related to issue with Fortran .mod files and make, e.g.: http://lagrange.mechse.illinois.edu/f90_mod_deps/ and it does not appear that there is a simple solution, but I'm curious if it is possible to improve the current implementation.

matthewhoffman commented 7 years ago

Note: one possible solution is to use Fortran 2008 submodule files, which are similar to C header files, e.g.: https://software.intel.com/en-us/articles/fortran-2008-submodule-support-in-intel-fortran-compiler However, from what I hear from a reputable source, they don't work with XLF.