On 2020-04-18 06:27, R. Diez wrote:
There is a catch, though: those flags are inherited over environment variable MAKEFLAGS. So I have to manually filter them out when calling submakefiles.

MAKEFLAGS is actually the solution. You can *add* to it and the flags take effect.

Therefore, it would be nice if you could specify those flags as
file-level directives, like this:

.NO_BUILT_IN_RULES:
.NO_BUILT_IN_VARIABLES:
.WARN_UNDEFINED_VARIABLES:

Thus:

  MAKEFLAGS += --no-builtin-rules ...

You do have to keep filtering that out for sub-makes, though.

Another idea is: instead of filtering MAKEFLAGS, save it and
restore it:

   SAVED_MAKEFLAGS := $(MAKEFLAGS)

Then in recursive recipes do MAKEFLAGS=$(SAVED_MAKEFLAGS) or whatever.


Reply via email to