> > The obvious problem is that when a module is changed without the
> > .mod file altering, it will recompile-and-recompare every time you
> > say "make". I don't think this can be altered without changing
> > "make".
>
> As a reminder the dependencies in my example were:
>
> prog.o : some.mod
> some.o some.mod: second.mod
>
> There is only a limited recompare and recompile effort.
> Returning to my original example (see earlier posting).
>
> If some.f90 is updated without changing some.mod file (e.g. touch
> some.f90) my version will recompile some.f90 to get a new some.mod for
> comparison since my compiler does not have a -mod option which would
> only produce the .mod file.
>
> Unfortunately some.f90 will be compiled every time make is used since
> some.mod is now older than some.f90. This is a tradeoff which we have
> to accept with the current make.
Peter Shenkin posted a solution that seems to work on comp.lang.fortran.
The trick consists of writing a rule to build the .mod files but do not
make them depend on the source file:
some.mod:
f90 $(FFLAGS) -c some.f90
You then have to be careful to write the program's dependencies in the
right order. You should write
prog: second.o some.o prog.o
and not
prog: prog.o some.o second.o
otherwise prog.o will sometimes not be recompiled when it should. I do
not know how portable it is, though (is this order really mandatory ?).
So it seems that having a compiler option to not overwrite the .mod file
when it is not changed would be useful.
--
Michel Beland [log in to unmask]
professionnel de recherche tel: (514)369-5223 fax: (514)369-3880
CERCA (CEntre de Recherche en Calcul Applique)
5160, boul. Decarie, bureau 400(423), Montreal (Quebec), Canada, H3X 2H9
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|