1diff --git a/make/PreInit.gmk b/make/PreInit.gmk
2index 3df44308dd..490d7c24e9 100644
3--- a/make/PreInit.gmk
4+++ b/make/PreInit.gmk
5@@ -60,13 +60,19 @@
6 # Extract non-global targets that require a spec file.
7 CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
8
9+# GNU make-4.4 (and later) include not just single-letter form of the
10+# options MAKEFILES but also long for and even some of the arguments.
11+# Skip long form and use only short form:
12+# MAKEFLAGS=' --debug=basic -- LOG=trace ...'
13+MAKEFLAGS_SINGLE_LETTER := $(firstword -$(MAKEFLAGS))
14+
15 # If we have only global targets, or if we are called with -qp (assuming an
16 # external part, e.g. bash completion, is trying to understand our targets),
17 # we will skip SPEC location and the sanity checks.
18 ifeq ($(CALLED_SPEC_TARGETS), )
19 SKIP_SPEC := true
20 endif
21-ifeq ($(findstring p, $(MAKEFLAGS))$(findstring q, $(MAKEFLAGS)), pq)
22+ifeq ($(findstring p, $(MAKEFLAGS_SINGLE_LETTER))$(findstring q, $(MAKEFLAGS_SINGLE_LETTER)), pq)
23 SKIP_SPEC := true
24 endif
25