bug-make
[Top][All Lists]
Advanced

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

target/dependants with equal mtime


From: Mark Allen
Subject: target/dependants with equal mtime
Date: Wed, 27 Sep 2000 20:42:18 -0700 (PDT)

The version of make I'm using is make-3.79.1.

Here's an outline of my mail:
  o  Artificial example makefile and command
  o  My expectations
  o  Observed behavior
  o  More realistic situation
  o  My modifications to "make" to get the behavior
     I expected

==================
Artificial example:
==================

- - - - Makefile - - - -
a: b
        touch a
b:
        touch b
- - - - - - - - - - - - -

And here is a command which demonstrates behavior
I think is erroneous:

% rm -f b ; touch a ; make a

===============
My expectations:
===============

I would expect it to see that "b" is not there, and
determine that it must make "b" as well as update
"a".  Thus I expect to see output

  touch b
  touch a

Result from the "make a" part of the command.

=================
Observed behavior:
=================

On a system where the fstat gives a mtime with
granularity in seconds (which seems typical), the
above command usually results in only

  touch b

being executed.  It looks at the dependancy list for
"a", decides it needs to make "b", does so, looks at
the date on "b" after it has made it, then decides
that
since "b" is not strictly newer than "a" based on the
date with 1-second granularity it won't update "a".

It seems to me it should either decide with certainty
that it will make "a" when it sees that an item in the
dependancy list doesn't exist yet, or it should build
targets when the dependancies have an equal date too,
not just strictly newer.

I'm sure there are implications to either of those
changes that need to be thought through though, and I
haven't done that.

========================
More realistic situation:
========================

The above makefile is obviously quite artificial.  A
more realistic example which is where I actually hit
the problem was like this

- - - - Makefile - - - -
libfoo.a: foo.o
        ar rcs libfoo.a foo.o

foo.o: foo.c
        cc -c foo.c
- - - - - - - - - - - - -

This Makefile was in a tree where each branch has
a similar makefile, and the branches are processed
sequentially.  Thus the previous branch had just
finished with ar'ing into libfoo.a, and the current
branch did not yet contain foo.o.  So it made foo.o
really fast (within 1 second of the previous branch
ar'ing into libfoo.a) so it saw the date on foo.o as
being equal to that on libfoo.a, so it didn't bother
to ar it into the archive.

================
My modifications:
================

Here's a diff of the file remake.c (from 3.79.1) which
(I think) changes make to do the update when it sees
the date of the target as being equal to the date of
the dependants.

There could be undesirable side-effects of my change,
or I might not have changed exactly what I thought I
did, but it made "make" behave as I expected in my
little example situation.  Anyway here's the changes
I made.

On lines 577, 817, and 845, the occurances of
  mtime > this_time
I changed to
  mtime >= this time

 - Mark


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
http://photos.yahoo.com/



reply via email to

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