[bug #45311] makes only one of two dependencies that depend on the same subdir-pattern rule

2015-07-11 Thread Paul D. Smith
Follow-up Comment #5, bug #45311 (project make):

We'd have to ask Roland or RMS; that behavior was already present when I first
started using GNU make, IIRC, and I'm not sure where it originated.

I think the idea that you can generate multiple outputs with a single command
is a very important capability, but I agree the current implementation (where
patterns and explicit targets work in opposite ways, and you can't get the
other way) is not ideal.

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?45311

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #45311] makes only one of two dependencies that depend on the same subdir-pattern rule

2015-06-13 Thread Frank Heckenbach
Follow-up Comment #4, bug #45311 (project make):

$@ wasn't the source of my confusion. Though the simplified test case would
indeed have worked if $@ expanded to all targets, my actual Makefile
wouldn't.

What confused me was the different behaviour of multiple-target rules with and
without patterns; the former are run once for all targets, the latter once for
each target. It seems quite unintuitive to me. Is there a reason for it, other
than historical?

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?45311

___
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #45311] makes only one of two dependencies that depend on the same subdir-pattern rule

2015-06-12 Thread Frank Heckenbach
URL:
  http://savannah.gnu.org/bugs/?45311

 Summary: makes only one of two dependencies that depend on
the same subdir-pattern rule
 Project: make
Submitted by: frank
Submitted on: Fr 12 Jun 2015 22:55:52 GMT
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 4.1
Operating System: POSIX-Based
   Fixed Release: None
   Triage Status: None

___

Details:

% cat Makefile
all: testdir/a testdir/b
%/a %/b:; touch $@
% rm -rf testdir
% mkdir testdir
% make
touch testdir/a
% make
touch testdir/b

The first make only makes a and forgets b. I wondered if my
rules are actually right like this, but since the second time
make does make b, it seems so to me. It works as expected when
I write two separate, but identical, rules for %/a and %/b.




___

Reply to this item at:

  http://savannah.gnu.org/bugs/?45311

___
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #45311] makes only one of two dependencies that depend on the same subdir-pattern rule

2015-06-12 Thread Paul D. Smith
Follow-up Comment #3, bug #45311 (project make):

Well, make walks targets one at a time, so there will always be a first
target which is determined to be out of date and matches a given pattern rule,
causing the recipe to fire.  That target is the one that will be set with $@. 
The rest of the targets are marked as also built.

I definitely wouldn't expect that $@ would contain multiple targets but maybe
it's just because I'm too close :).  Having something that is normally just
one file be multiple files is not expected, IMO.

In general in pattern rules with multiple targets, $* is more useful than $@.

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?45311

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #45311] makes only one of two dependencies that depend on the same subdir-pattern rule

2015-06-12 Thread Paul D. Smith
Update of bug #45311 (project make):

  Status:None = Not A Bug  
 Open/Closed:Open = Closed 

___

Follow-up Comment #1:

I may be missing something, but this looks correct to me.  A pattern rule with
multiple targets is different than an explicit rule with multiple targets: a
pattern rule with multiple targets invokes the recipe _one time_ and expects
that to build all the targets.  See the last paragraph in
http://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html

As expected, make runs your recipe only one time; it expects that both targets
will be created.

If there's something I'm misunderstanding please add a comment and I'll reopen
the bug.

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?45311

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #45311] makes only one of two dependencies that depend on the same subdir-pattern rule

2015-06-12 Thread David Boyce
Follow-up Comment #2, bug #45311 (project make):

I think the confusion here has to do with the value of $@. One might
reasonably expect, in a multi-target pattern rule, that $@ would be the list
of all matching out-of-date targets but in fact, according to the
documentation:

In a pattern rule that has multiple targets (see Introduction to Pattern
Rules), ‘$@’ is the name of whichever target caused the rule’s recipe to
be run.

Which is a bit unclear wrt the case where neither target exists, but does
imply strongly that $@ will refer to just one target.

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?45311

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make