http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49149
--- Comment #10 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-08-31 22:45:41 UTC --- On Wed, Aug 31, 2011 at 10:27:40PM +0000, zbeekman at gmail dot com wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49149 > > --- Comment #8 from Zaak <zbeekman at gmail dot com> 2011-08-31 22:27:40 UTC > --- > (In reply to comment #7) > > On Wed, Aug 31, 2011 at 10:01:06PM +0000, zbeekman at gmail dot com wrote: > > > > > > I hope you are less confused now. > > > > > > > I'm not confused. I do, however, use the grey matter > > between my ears to write my Makefiles. > > > > gfortran requires that the *.mod are present to > > parse your code. Sorry if you cannot deal with > > that fact. > > I didn't mean any insult, I am not trying to troll or start a flame war. I'm > sorry if I offended you in any way. I would appreciate you telling me why you > think my makefile is wrong rather than just insulting me. Did you read the > link > to the GNUmake manpage? Did you try executing the command outside of the > makefile? Yes, I scanned the GNU Make info file. I can find no information in that file concerning Fortran modules. I also scanned the GNU Fortran info file. I can find no mention of using -M to build the dependence for Fortran modules. In fact, -M does not appear anywhere in the GNU Fortran info file. So, one needs to peer into the GNU GCC info file. `-M' Instead of outputting the result of preprocessing, output a rule suitable for `make' describing the dependencies of the main source file. The preprocessor outputs one `make' rule containing the object file name for that source file, a colon, and the names of all the included files, including those coming from `-include' or `-imacros' command line options. Hmmm, no mention of a Fortran 'USE' statement. A 'USE' statement is a different beast than an 'INCLUDE' statement. > How would you write a makefile to automatically build fortran codes, and > resolve their dependencies without explicitly hand coding the dependencies? Well, as I write the Makefile, I automatically write the correct dependency. I do not depend on an inadequate tool to do the work for me. If you absolutely must have a tool, google makedepf90. PS: *.mod files are binary files.