[Top][All Lists]

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

Re: database buildup and reciepe execution

From: Paul Smith
Subject: Re: database buildup and reciepe execution
Date: Mon, 16 Jan 2012 08:50:58 -0500

On Mon, 2012-01-16 at 12:21 +0100, Warlich, Christof wrote:
> .PHONY: all
> all: PT xxx
> xxx: yyy ; cp $< $@
> PT: ; touch xxx
> Let's assume yyy is newer than xxx or that xxx doesn't exist. Why is
> the reciepe belonging to "xxx: yyy ; cp $< $@" not called after the
> reciepe belonging to "PT: ; touch xxx"? I would have thought that Make
> cannot know during buildup of its database that rule "PT: ; touch xxx"
> is going to update xxx?!

Make creates the dependency graph, which shows which targets depend on
which prerequisites, before it starts to run any rules.

But it does NOT check the modification time of all the targets before it
starts to run any rules.

Modification times are checked at the moment where we are trying to
build that target, not before.

So in this case, before we try to build target "xxx" we have already run
target "PT" which has updated the timestamp on target "xxx".  So when we
check the modification time on "xxx" we see it's newer than "yyy" and so
it doesn't need to be updated.

> Ok, make -d gave me some insight ... Make seems to run recipes
> immediately after it knows everything that needs to be done for that
> paricular rule _before_ looking ahead for the next dependency.

I'm not sure what you mean by "immediately after", but this doesn't
sound right (it could be a terminology thing).  See if my comments above
clarify things.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]