Re: Timestamp problem with multi-target build?

2000-08-03 Thread Paul D. Smith

%% Tommy Kelly [EMAIL PROTECTED] writes:

  tk I'm seeing an intermittent (i.e. two consecutive invocations
  tk can be different) results when I have a command which
  tk produces two targets.  It occurs when both targets are 
  tk themselves given as dependencies of the same higher target.

  tk sli4515:tommyk cat Makefile
  tk default : clean foo bar

  tk foo bar :
  tk touch foo bar
  tk sleep 1

This doesn't do what you think it does.  This rule is identical to:

  foo:
touch foo bar
sleep 1
  bar:
touch foo bar
sleep 1

That is, listing multiple targets in a normal rule are treated as if
you'd declared that rule for each target, _NOT_ as if that one command
script builds both targets.

See the GNU make manual discussion of the syntax of rule definitions.

So, you can see why you're getting the behavior you are.

The only way to do what you want is either with a dummy target, or using
multiple targets in a pattern rule, which _does_ behave this way (see
this section of the manual).

-- 
---
 Paul D. Smith [EMAIL PROTECTED]  Find some GNU make tips at:
 http://www.gnu.org  http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




Re: Timestamp problem with multi-target build?

2000-08-03 Thread Tommy Kelly

Thanks for the prompt reply.

I rewrote the targets with the pattern rules as you
suggested, and it now works fine.

Still not sure why that the behaviour I saw had the
"sleep" dependency though.  Even given that the rule I wrote 
was essentially two separate rules, I would have expected
the visit to the second of those rules merely to return
with a "Nothing to do for ...".

cheers,
t


"Paul D. Smith" [EMAIL PROTECTED] writes:

 %% Tommy Kelly [EMAIL PROTECTED] writes:
 
   tk I'm seeing an intermittent (i.e. two consecutive invocations
   tk can be different) results when I have a command which
   tk produces two targets.  It occurs when both targets are 
   tk themselves given as dependencies of the same higher target.
 
   tk sli4515:tommyk cat Makefile
   tk default : clean foo bar
 
   tk foo bar :
   tk touch foo bar
   tk sleep 1
 
 This doesn't do what you think it does.  This rule is identical to:
 
   foo:
 touch foo bar
 sleep 1
   bar:
 touch foo bar
 sleep 1
 
 That is, listing multiple targets in a normal rule are treated as if
 you'd declared that rule for each target, _NOT_ as if that one command
 script builds both targets.
 
 See the GNU make manual discussion of the syntax of rule definitions.
 
 So, you can see why you're getting the behavior you are.
 
 The only way to do what you want is either with a dummy target, or using
 multiple targets in a pattern rule, which _does_ behave this way (see
 this section of the manual).
 
 -- 
 ---
  Paul D. Smith [EMAIL PROTECTED]  Find some GNU make tips at:
  http://www.gnu.org  http://www.paulandlesley.org/gmake/
  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist