bugmake - Bugs: bug #19975, Add function: $(mtime foo.c) ->...


bug #19975: Add function: $(mtime foo.c) -> 1180203683

Submitter:  Matt McCutchen <hashproduct>
Submitted:  Sat 26 May 2007 06:39:58 PM UTC
Votes: 1
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  3.81 Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 29 May 2007 03:54:27 PM UTC, comment #3: 

That's wonderful news.  I'll work on the other parts of the tool for now and revisit the out-of-date criterion once I see the results of the Summer of Code project.

Matt McCutchen <hashproduct>
Tue 29 May 2007 02:31:04 PM UTC, comment #2: 

Note that GNU make has received a Google Summer of Code project, to implement the ability for users to customize the "out of date" algorithm used by make.  You might consider waiting a couple of months and see what comes of that by the end of the summer.  I have high hopes that it will be flexible and powerful enough to provide all the functionality people need to implement various algorithms including things like comparing stored stat(2) info as well as .KEEP_STATE capabilities.

Paul D. Smith <psmith>
Group administrator
Mon 28 May 2007 04:42:56 PM UTC, comment #1: 

Now that the AT&T nmake tool is opensource, you might be better off seeing if that will serve your needs rather than writing something on top of GNU make.


nmake already remembers the mtime for files and considers the file is out of date if the prerequsites mtime has changed.

It also remembers the values of flags, so if you change say "CFLAGS" (it calls it CCFLAGS for consistency with other languages) then it knows it should recompile everything.

Sat 26 May 2007 06:39:58 PM UTC, original submission:  

Please add a function $(mtime) that returns the modification time of a given file as the number of seconds since the Epoch.  This would be easy to do because make already caches mtimes.

I am writing a build tool on top of make, and I want it to have a better rule for whether a prerequisite makes a target out of date than make's.  Specifically, the tool will remember the prerequisite's mtime when the target was last built and consider the target out of date if the prerequisite's mtime has changed, forward or backward.  I want to implement this using a function in the target's prerequisite list that is called during second-expansion, checks the prerequisite's mtime, and expands to FORCE or nothing as appropriate.

The tool doesn't know which files' mtimes it is going to need until make actually gets to those files, so the tool can't easily do any better than getting the mtimes one at a time.  Getting each mtime currently requires running a stat(1) process, and doing this for every file checked (not just built) is intolerably slow.  The $(mtime) function would make it practical.

Matt McCutchen <hashproduct>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #12873:  make-func-mtime.diff added by hashproduct (1KiB - text/x-patch - Attempt at implementing $(mtime) function)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by hashproduct (Voted in favor of this item)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by hashproduct (Submitted the item)

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-11-28 hashproduct Carbon-Copy- Added hashproduct
    2007-05-27 hashproduct Attached File- Added make-func-mtime.diff, #12873

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code