This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Makefile with .mod files
- From: Ignacio Fernández Galván <jellby at yahoo dot com>
- To: fortran at gcc dot gnu dot org
- Date: Sat, 3 Nov 2007 19:11:03 +0000 (GMT)
- Subject: Re: Makefile with .mod files
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=XDxlOTGxFdyqpUdRu0zWnK5+OTSgGxGnsWC4G9SjqHJY9qKT7ZuaxnRwD0xH9ljooeMeCOiTBnQdt1UxBP42pkT0KZSAmbKOvA27/ArSodLxnqPnVPEjtBH6qH9LUGqR2TRvEp9+h3DvnxYEq52nlwZ/V+rLXCpqYDFABNWmzKk=;
--- FX Coudert <fxcoudert@gmail.com> wrote:
> This is a change from 4.2, IIRC, and it was done because users
> complained that .mod files had their timestamps updated while not
> changing, which triggered massive useless recompilations because of
> Makefile dependencies ;-)
Fair enough, I think that's OK
> > So, is there a solution for this?
>
> Yes, I believe there is; the following Makefile seems to work fine:
>
> all: a.o b.o
>
> a.o: a.f90 b.mod
> gfortran -c $<
>
> b.o: b.f90
> gfortran -c $<
>
> b.mod: b.f90 b.o
> @true
>
> a.mod: a.f90 a.o
> @true
It works... until one deletes the .mod files (which can happen by
accident), then make doesn't know how to build them. I guess I could
use something like "test -e $@ || gfortran -c $<" instead of "@true"...
Anyway, there is another (minor) problem: with that solution make still
thinks there is something to build and does not inform that everything
is up to date, even though it doesn't actually build anything.
Thanks.
Ignacio
___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/