help-make
[Top][All Lists]
Advanced

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

Re: Re-evaluate date of file after updating?


From: Norbert Nemec
Subject: Re: Re-evaluate date of file after updating?
Date: Tue, 30 Mar 2010 08:51:20 +0100
User-agent: Thunderbird 2.0.0.24 (X11/20100317)

Indeed! Thanks! I thought I had tried this, but obviously not in the right combination.

Isn't it funny? I was trying more and more complex solutions for the problem and was actually close to giving up. Now it turns out that my very first attempt was actually correct, except for the characters "; @:" ...

!"&^%^&!"%!&^%!!!!!

Greetings,
Norbert


Paul Smith wrote:
On Mon, 2010-03-29 at 17:50 +0100, Norbert Nemec wrote:

is there a way to define dependencies that re-evaluate the date of a file *after* updating it? Currently, the MAKE program blindly assumes that the target is actually modified its commands.

No it doesn't.  If the command script doesn't modify the timestamp on
the generated file then targets that depend on it won't consider it to
be updated.  This is very commonly used.

My best attempt at implementing this kind of dependencies in a Makefile is as follows

lib.mod: lib.o
lib.o: lib.f90
        mv lib.mod lib.mod.old
        f90 -c lib.f90
        diff -qN lib.mod.old lib.mod > /dev/null && mv lib.mod.old lib.mod
        rm -f lib.mod.old

This behaves nearly as needed, but unfortunately, the rule for prog.o does not care whether lib.mod has actually changed. It always recreates prog.o when lib.f90 was modified.

That's because there's no command sequence for lib.mod.  If you add a
"do nothing" command to the lib.mod: lib.o rule, I think it will work as
you expect (note I didn't test this):

        lib.mod: lib.o ; @:




--
_________________________________________Norbert Nemec
 71 High Street, Trumpington, Cambridge  CB2 9HZ, UK
   Tel: +44-1223-479234 Mobile: +44-752-8205872
         eMail:  <address@hidden>





reply via email to

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