[Top][All Lists]

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

Re: How to modify algorithm that determines weather a target needs rebui

From: mirage1987
Subject: Re: How to modify algorithm that determines weather a target needs rebuild
Date: Sun, 8 Aug 2010 22:18:05 -0700 (PDT)

Make cannot do this.

Make is entirely stateless--or put another way, make relies on comparing
state that is automatically maintained by the filesystem (time last
modified) to determine whether things need to be rebuilt.

In order to know whether something has a _different_ timestamp than it
used to have, you have to save some state: make (or whatever build tool)
has to keep a database of the timestamps that all the files had the last
time it was run, then the next time it is run make has to read that
database so it can compare the current modified time against the
previous modified time.

Make has no database and no storage mechanism like that, at the moment.

There was a Google Summer of Code project that was done to add
"user-defined out of date determination" to GNU make; however that ended
up being very complicated and only parts of it have been merged, so far.


Hi Paul,
Thanks for your response.
As you said "Make" is entirely stateless and relies on timestamps as
maintained by the filesystem.
This means at runtime it compares timestamp of each and every file with the
corresponding object file's timestamp.
What i just want is to change this condition from being "greater than" to
"equal to".
Instead of storing timestamps in the database i intend to modify the
timestamps on the filesystem using

So in short this what i want to achieve:
-Check if foo.o exists
     - Yes : 
           Check if timestamp of foo.o == timestamp of foo.c
               Dont build
               Build and touch foo.o to timestamp of foo.c
    - NO:
          Build foo.o and touch foo.o to timestamp of foo.c

It would be great if i could introduce this logic into the gnu make as it
has the notion of timestamps and i could use the same make file.

Please do let me know if i missing something or my understanding is wrong.

View this message in context:
Sent from the Gnu - Make - Help mailing list archive at

reply via email to

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