On Fri, Aug 9, 2024 at 9:09 PM Masahiro Yamada <masahi...@kernel.org> wrote:
> Which GNU Make version did you test?

4.3

> As I mentioned, commit fabb03eac412b5ea19f1a97be31dc8c6fa7fc047
> changed (fixed) the behavior, which introduced the inconsistency
> between grouped targets and a multi-target pattern rule.

You are right, the latest make build from master exhibits the behavior
that you reported.




> $ rm foo.*; touch foo.r; sleep 2; touch foo.p
> $ make-4.4  -f Makefile2
> $? = FORCE
> touch foo.p ; touch foo.q

i think, this one is correct.

> foo.r is a prerequisite newer than foo.q
> (but older than foo.p), so I believe foo.r should
> be contained in $?

i think, foo.r should not be in $? in this case.
make first considers foo.p. Make finds out that foo.p needs to be
rebuilt due to FORCE. The recipe builds both foo.p and foo.q.
Automatic variables are set per recipe execution. When this recipe
runs, $? is set to FORCE, because FORCE is the prerequisite that
caused the recipe to run.
foo.q is not even considered at all at this point.
Then make considers foo.q and finds out that foo.q is already built.
Make runs no recipe specifically for foo.q and so no automatic
variables are set for foo.q.

I opened https://savannah.gnu.org/bugs/index.php?66073.
Thank you for your report.

regards, Dmitry

Reply via email to