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: Mark Galeck (CW)
Subject: RE: this is embarrasing... prerequisiste gets updated, but make still says it is older than target
Date: Mon, 2 Apr 2012 05:01:16 -0700

Well pardon me, but I read the manual carefully what it says about this, and it 
is very clear, and it says the same thing in several places:

After updating the prerequisites, make runs the recipe for the target if and 
only if the target does not exist or it is older than any of the prerequisites.

Notice that this statement does not say _anything_ about the insides of how the 
prerequisites are updated.  It is "recursive".  When I run >make foobar1, on 
this makefile, make updates foobar1.  

Now, consider the target foobar, and prerequisite foobar1.  foobar1 is updated, 
somehow and it moves the timestamp of foobar1 to newer than foobar. Therefore 
by the manual, foobar should update.  


Where does it say something else in the manual?  I need to know in which cases 
the above statement is contradicted.



> foobar: foobar1
>         touch $@
> 
> foobar1:  foobar_phony
> 
> .PHONY: foobar_phony
> foobar_phony:
>         touch foobar1

So here you have a rule (foobar_phony) where the recipe doesn't create
the target it said it would, AND it creates some other target instead.

Make basically tells you all you need to know right here:

>     Successfully remade target file `foobar_phony'.
>    Finished prerequisites of target file `foobar1'.
>    Prerequisite `foobar_phony' of target `foobar1' does not exist.
>   No commands for `foobar1' and no prerequisites actually changed.
>   No need to remake target `foobar1'.

So make ran the rule to rebuild the target foobar_phony, but the target
was not changed, and in fact doesn't exist.  Then make notes that there
is no recipe for the "foobar1: foobar_phony" target, so obviously
there's nothing here that would cause foobar1 to be updated.  Make sees
that there is nothing that could have updated foobar1, so it doesn't
need to rebuild foobar either.



reply via email to

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