[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: Paul Smith
Subject: Re: How to modify algorithm that determines weather a target needs rebuild
Date: Sun, 08 Aug 2010 14:42:37 -0400

On Sat, 2010-08-07 at 23:10 -0700, mirage1987 wrote:
> I want to do this because the timestamp of my source file (foo.c)
> could change both back and forth.  So i need to build the target only
> if the timestamp changes for source.
> Is it possible to achieve this by just defining the makefile rules or
> would i need to modify the code of GNU make.

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.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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