On Mon, 2025-11-24 at 15:36 -0500, Joe Flack wrote:
> >   cause the command-line goals' timestamps to be updated to "now",
> > without actually checking and udpating the prerequisites.
> Something else I hadn't considered! This is a big problem for this
> feature...

It's not as big a problem as you might think at first.  For example,
consider this simple makefile:

  foo: foo.o bar.o baz.o

Now you run "make --ignore-prereqs foo" so that foo is rebuilt without
trying to first rebuild the prerequisites.

Suppose baz.o is newer than foo.  Well, foo is rebuilt so foo will
contain the changes in baz.o and the timestamps are aligned (foo is
newer than all the .o files, but foo contains all the changes to all
the .o files so that's OK).

Now suppose bar.c is newer than bar.o: because of the --ignore-prereqs
bar.o will not be updated so while foo is up to date with respect to
the .o files it's out of date with respect to the source files.  But,
presumably that's what you wanted and expected when you provided that
flag!

Now what happens if you run "make foo" (without the flag)?  Well, make
will see that bar.c is newer than bar.o, rebuild bar.o, and now bar.o
is newer than foo and foo will be relinked.  It's the same as if you'd
edited bar.c _after_ you'd run the ignore-prereqs make.  So there is no
lasting damage done.

My concern is that there could be situations with more complex
makefiles, where there could be problems.  I'd have to think more
deeply about what would be needed, to get a problematic outcome.

> Ideally it'd be good to not update the timestamp. But I think that's
> not possible.

It would be possible for make to remember the modification time before
invoking the rule, then reset the it on the target after the rule
completes.  But I kind of don't like this, as too magical.

Reply via email to