@@ -38,6 +38,12 @@ __all:
# descending is started. They are now explicitly listed as the
# prepare rule.
+ifeq ($(filter 3.%,$(MAKE_VERSION)),)
+short-opts := $(firstword -$(MAKEFLAGS))
+else
+short-opts := $(filter-out --%,$(MAKEFLAGS))
+endif
+
this-makefile := $(lastword $(MAKEFILE_LIST))
abs_srctree := $(realpath $(dir $(this-makefile)))
abs_objtree := $(CURDIR)
@@ -95,12 +101,6 @@ endif
# commands
# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
-ifeq ($(filter 3.%,$(MAKE_VERSION)),)
-short-opts := $(firstword -$(MAKEFLAGS))
-else
-short-opts := $(filter-out --%,$(MAKEFLAGS))
-endif
-
ifneq ($(findstring s,$(short-opts)),)
quiet=silent_
override KBUILD_VERBOSE :=
@@ -215,12 +215,16 @@ else
need-sub-make := 1
endif
+ifeq ($(findstring w, $(short-opts)),)
ifeq ($(filter --no-print-directory, $(MAKEFLAGS)),)
# If --no-print-directory is unset, recurse once again to set it.
# You may end up recursing into __sub-make twice. This is needed due to the
# behavior change in GNU Make 4.4.1.
need-sub-make := 1
endif
+else
+no-print-directory :=
+endif
ifeq ($(need-sub-make),1)