On Mon, 2025-02-10 at 03:40 +0900, Masahiro Yamada wrote:
> ifeq ($(SUBMAKE),)
> MAKEFLAGS += --no-print-directory
> MAKEFLAGS += -rR
> all:
>         @echo in top: MAKEFLAGS=$(MAKEFLAGS)
>         $(MAKE) -w SUBMAKE=1
> else
> all:
>         @echo in submake: MAKEFLAGS=$(MAKEFLAGS)
> endif
> 
> 
> $ make
> in top: MAKEFLAGS=rR --no-print-directory --print-directory
> make SUBMAKE=1
> in submake: MAKEFLAGS=rR --no-print-directory -- SUBMAKE=1

You don't specify which version of GNU Make you're using, but this
works as expected in the current release:

  ~$ make --version
  GNU Make 4.4.1
    ...

  ~$ make
  in top: MAKEFLAGS=rR --no-print-directory
  make -w SUBMAKE=1
  make[1]: Entering directory '/tmp/foo'
  in submake: MAKEFLAGS=rRw -- SUBMAKE=1
  make[1]: Leaving directory '/tmp/foo'


Reply via email to