This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Makefile with .mod files
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Ignacio Fernández Galván <jellby at yahoo dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Sat, 3 Nov 2007 12:10:00 +0000
- Subject: Re: Makefile with .mod files
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; bh=ZoZaya+t4uN8XXrG8iUrtSHRLIG8/0gDodkOfe5xvF8=; b=YCghtKGCUyFVqLXuu29s/Bd2xtit9WUAnr7vFOrHCQxifufugeYTPTfJcAeDraN8beCl/tux73Wt+ZfhjfpLS184k3+NmblPxms5SWdHk4iJXkjRBebTsiOJHUg/N26rnLje8u+moUtTSBcFlxpJR7ps7LtXacFTJD/n7HXz2hA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=ldUZ7S7pkr6hGGioZcZbFY+s9XLi7lAUxxcyUDJJQw7iWpvI2olAZJ0GOLalDn0sVDRirliDWqXud65nWJuY9nOwPiDy1LRgJiYI6UhXVyBbsKExDX4DauW0RyML8Gko4hh1583Ttl+BAcgvzoRDbOnRdCnPSr+Wd6f8rJg47GQ=
- References: <532357.22547.qm@web33009.mail.mud.yahoo.com>
I'm having some problems with a Makefile for a Fortran program, and
I've tracked it down to the fact that .mod files don't have their
timestamp updated when compiling if they don't change.
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 ;-)
all: a.o b.o
a.mod a.o: a.f90 b.mod
gfortran -c $<
b.mod b.o: b.f90
gfortran -c $<
Now I have to run "make" twice, I guess it's because make does not
know
b.mod can change due to a change in b.f90, as it is an order-only
dependency...
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
I know it's not as easy as one could hope, but I intend to add
options to generate Makefile dependencies (-M options) in gfortran-4.4.
Regards,
FX