%% Jesse Thilo <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>          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

_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to