[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #66073] $? is set incorrectly in the case of grouped targets.
From: |
Paul D. Smith |
Subject: |
[bug #66073] $? is set incorrectly in the case of grouped targets. |
Date: |
Sun, 11 Aug 2024 20:11:54 -0400 (EDT) |
Follow-up Comment #3, bug #66073 (group make):
I don't understand why the previous comment is talking about foo.q. In what
way would it ever be correct for foo.q to appear in "$?"? foo.q is one of the
targets and "$?" lists the out of date prerequisites.
Maybe the comment intended to use "foo.r" instead?
I understand what is being requested and it makes sense at some level.
However I can't reproduce the "desired" behavior in the current version of GNU
Make HEAD. I used this makefile:
MAKEFLAGS += -rR
.RECIPEPREFIX = >
xfoo: foo.p foo.q
xbar: bar.p bar.q
foo.p foo.q &: foo.r FORCE
> @echo '$$? = $?'
> touch foo.p foo.q
%.p %.q : %.r FORCE
> @echo '$$? = $?'
> touch $*.p $*.q
.PHONY: xfoo xbar FORCE
to combine both makefiles into a single makefile.
Whether or not we see *foo.r* (or *bar.r*) included in the output depends
entirely on which target is touched before we start make and which is not.
For example if I use the original description and touch *foo.p* / *bar.p*
first, then I see the "undesired" behavior for both explicit and pattern
grouped targets:
$ rm -f foo.* bar.* ; touch foo.r bar.r; sleep 1; touch foo.p bar.p; make
xfoo
$? = FORCE
touch foo.p foo.q
$ rm -f foo.* bar.* ; touch foo.r bar.r; sleep 1; touch foo.p bar.p; make
xbar
$? = FORCE
touch bar.p bar.q
If on the other hand I touch *foo.q* / *bar.q* first, I see the "desired"
behavior for both:
$ rm -f foo.* bar.* ; touch foo.r bar.r; sleep 1; touch foo.q bar.q; make
xfoo
$? = foo.r FORCE
touch foo.p foo.q
$ rm -f foo.* bar.* ; touch foo.r bar.r; sleep 1; touch foo.q bar.q; make
xbar
$? = bar.r FORCE
touch bar.p bar.q
Am I missing some important aspect of the original example that was posted?
As far as I can see commit fabb03eac412b5ea19f1a97be31dc8c6fa7fc047 is not
related to this. It does change the mtime of also-make targets which maybe is
related somehow.
Dmitry's explanation of what is happening is correct. Whether that's the
right behavior or not, needs to be considered. Also what would be involved
with changing the behavior.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66073>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature