Follow-up Comment #1, bug #65685 (group make):

Make adds '-j' to MAKEFLAGS and MFLAGS when -j is specified on the command
line.
When MFLAGS that contains -j is expanded in a recipe, the submake gets -j as
a command line switch. This causes submake to start its own jobserver and the
submake no longer participates in the parent jobserver.


$ ls
makefile  makefile2
$ cat makefile 
all:; $(MAKE) -fmakefile2 $(MFLAGS)
$ cat makefile2
all:;:
$ make --no-print-directory -j4
make -fmakefile2 -j4 --jobserver-auth=3,4 --no-print-directory
make[1]: warning: -j4 forced in submake: resetting jobserver mode.
:


This was recently reported to the bash mailing list.
https://lists.gnu.org/archive/html/bug-bash/2024-04/msg00078.html.

Submakes don't need -j to participate in the top make's jobserver.
The obvious temptation is to keep MAKEFLAGS and MFLAGS free of -j.
However, -j needs to stay in MAKEFLAGS to allow makefiles to append -j to
MAKEFLAGS.
E.g. the following code needs -j in MAKEFLAGS.


MAKEFLAGS+=-j2


This patch modifies make to avoid -j in MFLAGS.
This patch keeps MAKEFLAGS intact.
Ofcourse, if the user explicitly expands MAKEFLAGS in a recipe they are back
to
the quare one. Explicitly expanding MFLAGS in a recipe is legalized in the
make manual, but explicitly expanding MAKEFLAGS is not. On top of that
explicitly expanding MAKEFLAGS has other isses, see
https://savannah.gnu.org/bugs/?62469.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65685>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/


Reply via email to