From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24550 invoked by alias); 31 Aug 2011 22:01:52 -0000 Received: (qmail 24540 invoked by uid 22791); 31 Aug 2011 22:01:51 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 31 Aug 2011 22:01:37 +0000 From: "zbeekman at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/49149] Dependency autogeneration with `-M` rendered useless by requiring .mod files Date: Wed, 31 Aug 2011 22:18:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zbeekman at gmail dot com X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg02588.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49149 --- Comment #6 from Zaak 2011-08-31 22:01:06 UTC --- I ma not saying gfortran is entirely broken, i'm merely claiming that there is a bug in the dependency resolution feature. Please see GNU Make documentation here for more information about Generating Prerequisites Automatically: http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites There is nothing wrong with my makefile. GNU make looks for rules to build any included makefiles and builds and updates them before running the rest of the makefile. It is this very step that gives me problems too, but because it requires the presence of types.mod before it can run the rule to make modutils.d and myprog.d. The rule to make these files uses gfortran's dependency resolution features which is where the problem is. The following step is what is causing the failure: gccbug $ gfortran -M -cpp modutils.f90 | sed '1 s/^/modutils.d /' > modutils.d This is perfectly reasonable thing to want to do and produces the following output: modutils.f90:2.11: USE types 1 Fatal Error: Can't open module file 'types.mod' for reading at (1): No such file or directory The whole point, again, is that we should not need the binary .mod files to accomplish dependency resolution because these .mod files have dependencies which must be resolved in order to create them. The source code file should be parsed for binary objects (.o and .mod) which it produces and which it depends on. The parsing of these source codes and the extraction of this information should not require dependencies and should be order agnostic. I hope you are less confused now.