bug-make
[Top][All Lists]
Advanced

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

Re: failure to rebuild file (make 3.79)


From: Paul D. Smith
Subject: Re: failure to rebuild file (make 3.79)
Date: Thu, 23 Nov 2000 00:43:57 -0500

%% Jesse Thilo <address@hidden> writes:

  jt> I believe I've found a bug in the current version of make.  To
  jt> reproduce, extract the three files from the attached tarball and
  jt> perform the following commands:

  jt>    make
  jt>    touch touch-me
  jt>    make

  jt> Not that "one.o" is not rebuilt, even though "one.c" is newer.

This is correct behavior.  Make doesn't know that you've modified one.c,
because you're tricking it--but not thoroughly enough :).

Make won't stat() files to find out if they've changed unless it has
reason to suspect that they might have done so.

In your makefile, you declare one.c to depend on stamp-gen, but it's
_stamp-gen_ which actually updates one.c.  There's no way make can guess
that, since there's nothing in the makefile to tell it.

Make sees that stamp-gen was rebuilt, so it knows one.c is now
out-of-date.  It then looks around but finds no rule to create one.c
from stamp-gen.  Therefore, it doesn't run any commands.  Since no
commands are run to update it, make "knows" that the timestamp of one.c
cannot have been changed--so it doesn't rebuilt one.o.

What you need to do is trick make more decisively; provide _some_ kind
of command for the "one.c : stamp-gen" prerequisite.  It is sufficient
to change this line:

  $(GENFILES): stamp-gen

to this:

  $(GENFILES): stamp-gen ;

The extra semicolon (empty command) will convince make that some rule
was actually run that _could_ have updated one.c, and so it'll check the
timestamp on one.c and note that it's newer than one.o, and rebuild
properly.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]