help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make and Fortran modules


From: Noel David Torres Taño
Subject: Re: Make and Fortran modules
Date: Thu, 1 Apr 2010 17:42:26 +0200
User-agent: KMail/1.9.9

On Tuesday 30 March 2010 15:27:26 Alberto Luaces wrote:
> Noel David Torres Taño writes:
> 
> > Hello all:
> >
> > Fortran modules are made by compiling source code, at the same time object 
> > files are. Thus,
> >
> > gfortran -o module.o -c module.F95
> >
> > produces TWO files, module.o AND module.mod .
> >
> > But, the problem is that in a large project using modules, some objects 
> > depend on other modules:
> >
> > %.o : %.F95
> >
> > %.mod : %.F95
> >
> > codepiece2.o : codepiece1.mod
> >
> > exec1 : codepiece1.o codepiece2.o
> >
> > exec2 : codepiece3.o codepiece2.o
> >
> > How do you address these issues?
>  
> You have to write the rules describing those dependencies by yourself or
> with the aid of a script that reads the Fortran files and guesses the
> modules each one is using. Yesterday I posted a link to some information
> about the issue.
> 
> --
> Alberto

Gracias, Alberto, but I'm not talking about writing the dependences, but 
avoiding unnecesary work. My Makefile depends on source code files, 'cos the 
dependences are auto-extracted, thus I want to avoid as much $(MAKE) calls as 
possible.

What I'm doing just now to avoid those cascades is:

%.mod : %.F95
        @echo $(MAKE) $*.o
        @(export temp=`mktemp` ;\
        touch -r $*.F95 $$temp ;\
        touch $*.F95 ;\
        $(MAKE) $*.o ;\
        touch -r $$temp $*.F95 ;\
        rm $$temp)

What do you think about that?

Un saludo

Noel

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]