help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

filtering job options from MAKEFLAGS, manually


From: Laszlo Ersek
Subject: filtering job options from MAKEFLAGS, manually
Date: Wed, 23 Jan 2019 11:24:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi!

I've got a peculiar problem. There is an outer makefile and an inner
makefile. The inner makefile comes from a project (a git submodule) that
is maintained separately from the outer makefile (the git superproject).

The outer makefile is "make -j"-clean. The inner makefile isn't.

In the outer makefile, we can use .NOTPARALLEL to make sure the inner
make is launched only in isolation, to build the relevant artifacts one
by one. That is, there are no multiple inner "make" processes
"competing" on the subproject.

However, the inner make inherits "-j" and "--jobserver-fds=3,4" from the
outer make via MAKEFLAGS. And, if the job server in the outer make lets
it, the inner make will happily parallelize recipes from the inner
makefile, even just to build a single target (build artifact). The inner
makefile is not suitable for that however.

The GNU make documentation suggests that we should add .NOTPARALLEL to
the inner makefile explicitly.

https://www.gnu.org/software/make/manual/make.html#index-_002eNOTPARALLEL

"Any recursively invoked make command will still run recipes in parallel
(unless its makefile also contains this target)."

It also suggests that MAKEFLAGS can be filtered manually, for options
*other than* "-j" (and some other special options).

https://www.gnu.org/software/make/manual/make.html#Options_002fRecursion


Would it be safe / robust to filter out "-j" and "--jobserver-fds=3,4"
as well, manually? (E.g. by sticking a shell script between the outer
and inner make processes.) In particular, "--jobserver-fds" is not
documented in end-user documentation, apparently, so I get a feeling
this option could change at any time, as an implementation detail of
distributing jobs.

Thank you very much,
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]