http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47720
--- Comment #4 from Zaak <zbeekman at gmail dot com> 2011-05-25 19:56:38 UTC --- I'm not a gfortran dev, but the duplicates are likely due to the fact the the source code is being parsed and there is need to remove duplicates, since the output is intended for consumption by make. The idea is to run gfortran -M -cpp before running gfortran -c to compile the code. Then you can include the .d files produced with the -M flag in your makefile. See for example: http://theory.uwinnipeg.ca/localfiles/infofiles/make/make_43.html I suspect, however, that if you swapped the names of your two files, and removed all of the .mod files, you will run into the bug posted here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49149 (Or rename makegen1.f90 to makegen3.f90) You should be able to start with only source files (no compiled or objects processed by gfortran) and do: $ gfortran-4.6 -cpp -M makegen?.f90 If the nighly build, or whatever you're using still has the same bug as 4.6.0 then the above command will complain about missing .mod files, which defeats the purpose of having such a utility in the first place. (The goal is to resolve dependencies, but to do this you need some .mod files. Which ones? well go resolve some dependencies and find out. Oh...wait I can't resolve dependencies unless I already have them.... in which case I don't need to resolve them anymore)