On Sat, Aug 10, 2024 at 8:01 AM Dmitry Goncharov <dgoncha...@users.sf.net> wrote: > > On Fri, Aug 9, 2024 at 8:07 AM Masahiro Yamada <masahi...@kernel.org> wrote: > > The value of $? is different. > > What do you observe if you wait between touching foo.r and touching foo.p? > > $ rm foo.*; touch foo.p; sleep 2; touch foo.r > $ make -f makefile1 > $? = foo.r FORCE > touch foo.p ; touch foo.q > $ > $ rm foo.*; touch foo.p; sleep 2; touch foo.r > $ make -f makefile2 > $? = foo.r FORCE > touch foo.p ; touch foo.q > $ > $ > $ rm foo.*; touch foo.r; sleep 2; touch foo.p > $ make -f makefile1 > $? = FORCE > touch foo.p ; touch foo.q > $ rm foo.*; touch foo.r; sleep 2; touch foo.p > $ make -f makefile2 > $? = FORCE > touch foo.p ; touch foo.q > > > regards, Dmitry
Which GNU Make version did you test? As I mentioned, commit fabb03eac412b5ea19f1a97be31dc8c6fa7fc047 changed (fixed) the behavior, which introduced the inconsistency between grouped targets and a multi-target pattern rule. The first example you gave was never a problem because foo.p is outdated and foo.q is missing. The problematic case is foo.p is up-to-date, and foo.q is missing. [before fabb03eac412b5ea19f1a97be31dc8c6fa7fc047] $ rm foo.*; touch foo.r; sleep 2; touch foo.p $ make-4.3 -f Makefile1 $? = FORCE touch foo.p ; touch foo.q $ rm foo.*; touch foo.r; sleep 2; touch foo.p $ make-4.3 -f Makefile2 $? = FORCE touch foo.p ; touch foo.q [after fabb03eac412b5ea19f1a97be31dc8c6fa7fc047] $ rm foo.*; touch foo.r; sleep 2; touch foo.p $ make-4.4 -f Makefile1 $? = foo.r FORCE touch foo.p ; touch foo.q $ rm foo.*; touch foo.r; sleep 2; touch foo.p $ make-4.4 -f Makefile2 $? = FORCE touch foo.p ; touch foo.q I just thought fabb03eac412b5ea19f1a97be31dc8c6fa7fc047 addressed the issue in a consistent way between grouped targets and a pattern rule. When any of (foo.p, foo.q) is missing or out of date, even if make is primarily trying to build foo.p (because all: depends on foo.p and foo.q in this order), we end up with rebuilding both foo.p and foo.q simultaneously in a single recipe. foo.r is a prerequisite newer than foo.q (but older than foo.p), so I believe foo.r should be contained in $? -- Best Regards Masahiro Yamada