Subject: Re: bin/34934: make sometimes fails to handle multiple targets on the left correctly
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: David Holland <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 10/29/2006 18:35:03
The following reply was made to PR bin/34934; it has been noted by GNATS.

From: dholland@eecs.harvard.edu (David Holland)
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	dholland@eecs.harvard.edu
Subject: Re: bin/34934: make sometimes fails to handle multiple targets on the left correctly
Date: Sun, 29 Oct 2006 13:29:39 -0500 (EST)

  >  If you have:
  >  
  >  a1 a1: b
         ^2
  >  	echo $@
  >  
  >  The make runs the rules twice, once for a1 and once for a2.
  >  This is the correct and required behaviour.
  >  (Otherwise the above could't output 'a1' and 'a2'.)
 
 Yes.
 
 It's not a matter of what the rules mean; it's a matter of when
 timestamps can and cannot be cached. If you have
 
 a1 a2: b
 	echo foo > a1; echo bar > a2
 
 then after running the recipe make is required to check and ascertain
 that both a1 and a2 have been updated. Then it won't run the recipe a
 second time. Whereas if you don't list both a1 and a2 on the left make
 is allowed to assume that the one not listed isn't modified, and this
 can cause things to go wrong later. (Lying to make rarely goes
 unpunished.)
 
 You'll note that make does actually do this; the problem is that
 something breaks some of the time if a1 and a2 are in another
 directory.
 
 -- 
    - David A. Holland / dholland@eecs.harvard.edu