http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47495
Summary: .mod files: File modification time - Makefile build issue Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org Problem described by Thomas Henlich at http://gcc.gnu.org/ml/fortran/2011-01/msg00242.html Currently, gfortran only updates the .mod file (content and file modification date) if the file changes. That change has been introduced 2007 with PR 31587 and http://gcc.gnu.org/ml/fortran/2007-04/msg00331.html The issue is the compilation cascade: (a) If the source file changes, but the .mod file does not there should be no recompilation of module USErs required (b) If the source file changes and a new .o is produced, there is no need to recompile the source to produce another .mod file with the same modification date. As Thomas' email shows, the current Makefile as written by "gfortran -M" cause a contiguous recompilation of the source files: mymodule.o mymodule.mod: mymodule.f90 gfortran -c mymodule.f90 will always recompile the file as "mymodule.mod" stays older than "mymodule.f90". On the other hand, for: myprogram.o: myprogram.f90 mymodule.mod gfortran -c myprogram.f90 the file will only be recompiled if mymodule.mod actually changes, which is good. The question is: How can one solve this properly? Possibly without dating back the creation date of the .f90 file ...