help-make
[Top][All Lists]
Advanced

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

Re: this is embarrasing... prerequisiste gets updated, but make still sa


From: Lane Schwartz
Subject: Re: this is embarrasing... prerequisiste gets updated, but make still says it is older than target
Date: Mon, 2 Apr 2012 09:57:43 -0400

Mark & Paul,

I think we can agree that this is an odd situation.

Mark, I think the reason you're running into this problem is that your
rules are not following the expected behavior for make rules.

This rule is what's causing the problem:

resources: phony
       touch foobar1
       touch $@

If you want make to perform as you expect it to, in every rule, you need to
accurately tell make what files that rules updates. If you fail to do this,
it's not surprising that you get unexpected results. The following update
would fix your problem:

resources foobar1: phony
       touch foobar1
       touch $@

Without this change, make has no way of knowing that the above rule changes
the file foobar1. See the following in section 4.2 "A rule tells make two
things: when the targets are out of date, and how to update them when
necessary."

Your existing rule fails to tell make that it causes foobar1 to be out of
date.



Paul, I think Mark is being a bit pedantic, but he is right that that
section 4.2 could be clarified slightly to reflect the reality of your
description in your previous emails. Perhaps something like the following,
where new sentence #2 is added between sentence #1 and sentence #3 near the
end of section 4.2.

1) "A target is out of date if it does not exist or if it is older than any
of the prerequisites (by comparison of last-modification times)."

NEW 2) "All computation of prerequisite timestamps are performed prior to
the execution of any make rule."

3) "The idea is that the contents of the target file are computed based on
information in the prerequisites, so if any of the prerequisites changes,
the contents of the existing target file are no longer necessarily valid.

Thanks,
Lane


On Mon, Apr 2, 2012 at 8:41 AM, Mark Galeck (CW) <address@hidden>wrote:

> Paul, you can disagree with me, but I believe the manual is grossly
> misleading here.  None of what you describe is actually in the manual.
>
> Instead, the manual says first in section 2.3. by way of an example, and
> then in Section 4.2:
>
> "After recompiling whichever object files need it, make decides whether to
> relink edit. This must be done if the file edit does not exist, or if any
> of the object files are newer than it. If an object file was just
> recompiled, it is now newer than edit, so edit is relinked."
>
> "A target is out of date if it does not exist or if it is older than any
> of the prerequisites (by comparison of last-modification times).       "
>
>
> The above, clearly suggests, the checking of the timestamp is done after
> the updates of the prerequisites.  Not at any other time.
>
>
> OK, you are saying that is not the case.  Please state clearly exactly
> when and how make checks the timestamps of prerequisites of the target of a
> rule, for the purpose of deciding whether to update the target.
>
>
> Thank you,
>
> Mark
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make
>



-- 
When a place gets crowded enough to require ID's, social collapse is not
far away.  It is time to go elsewhere.  The best thing about space travel
is that it made it possible to go elsewhere.
                -- R.A. Heinlein, "Time Enough For Love"


reply via email to

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