This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Makefile with .mod files


--- 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/ 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]