help-make
[Top][All Lists]
Advanced

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

Re: Will a rule be updated if its dependent file is modified by another


From: Paul Smith
Subject: Re: Will a rule be updated if its dependent file is modified by another rule?
Date: Thu, 4 Mar 2010 19:39:48 -0500

On Thu, 2010-03-04 at 17:41 -0600, Peng Yu wrote:
> Suppose I have file2 that is newer than file1, and file4 is older than
> file3. In the trials that I did, both rules in the makefile are always
> executed. I'm wonder if this is always true. Or I just happen to
> observer this behavior?
> 
> .PHONY: all
> 
> all: file1 file2
> 
> file3: file4
>       touch file3
> 
> file1: file2
>       touch file1
>       touch file3

Are you SURE both rules are executed?  You didn't show the command you
ran or the output you got.  Note that if both rules are really executed
you should see "touch file3" _twice_, once for the rule to build file1
and once for the rule to build file3.  Maybe it would be easier to see
what was really going on if you included some kind of "echo building $@"
in your rules or similar.

I cannot reproduce your behavior: if file2 is newer than file1 and file4
is older than file3, then make rebuilds file1 (but this touches both
file1 and file3) but does not run the command to build file3.  That's as
I would expect.





reply via email to

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